Skip to content

Commit

Permalink
deprecated support for mbstring.func_overload != 0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 19, 2016
1 parent 4c96031 commit 1c2eb15
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
@@ -1,6 +1,6 @@
* 1.28.2 (2016-XX-XX)
* 1.29.0 (2016-XX-XX)

* n/a
* deprecated support for mbstring.func_overload != 0

* 1.28.1 (2016-11-18)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -40,7 +40,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.28-dev"
"dev-master": "1.29-dev"
}
}
}
2 changes: 1 addition & 1 deletion ext/twig/php_twig.h
Expand Up @@ -15,7 +15,7 @@
#ifndef PHP_TWIG_H
#define PHP_TWIG_H

#define PHP_TWIG_VERSION "1.28.2-DEV"
#define PHP_TWIG_VERSION "1.29.0-DEV"

#include "php.h"

Expand Down
2 changes: 2 additions & 0 deletions lib/Twig/Compiler.php
Expand Up @@ -216,6 +216,8 @@ public function addDebugInfo(Twig_NodeInterface $node)
// mb_substr_count() replaces substr_count()
// but they have different signatures!
if (((int) ini_get('mbstring.func_overload')) & 2) {
@trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED);

// this is much slower than the "right" version
$this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n");
} else {
Expand Down
8 changes: 4 additions & 4 deletions lib/Twig/Environment.php
Expand Up @@ -16,11 +16,11 @@
*/
class Twig_Environment
{
const VERSION = '1.28.2-DEV';
const VERSION_ID = 12802;
const VERSION = '1.29.0-DEV';
const VERSION_ID = 12900;
const MAJOR_VERSION = 1;
const MINOR_VERSION = 28;
const RELEASE_VERSION = 2;
const MINOR_VERSION = 20;
const RELEASE_VERSION = 0;
const EXTRA_VERSION = 'DEV';

protected $charset;
Expand Down
4 changes: 4 additions & 0 deletions lib/Twig/Lexer.php
Expand Up @@ -85,6 +85,10 @@ public function tokenize($code, $name = null)
$source = $code;
}

if (((int) ini_get('mbstring.func_overload')) & 2) {
@trigger_error('Support for having "mbstring.func_overload" different from 0 is deprecated version 1.29 and will be removed in 2.0.', E_USER_DEPRECATED);
}

if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('ASCII');
Expand Down

0 comments on commit 1c2eb15

Please sign in to comment.