Skip to content

Commit

Permalink
feature #2271 Deprecate support for mbstring.func_overload != 0 (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.x branch.

Discussion
----------

Deprecate support for mbstring.func_overload != 0

see https://wiki.php.net/rfc/deprecations_php_7_2

Commits
-------

6668d47 deprecated support for mbstring.func_overload != 0
  • Loading branch information
fabpot committed Nov 23, 2016
2 parents 2436915 + 6668d47 commit 717365d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
* 1.28.3 (2016-XX-XX)
* 1.29.0 (2016-XX-XX)

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

* 1.28.2 (2016-11-23)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef PHP_TWIG_H
#define PHP_TWIG_H

#define PHP_TWIG_VERSION "1.28.3-DEV"
#define PHP_TWIG_VERSION "1.29.0-DEV"

#include "php.h"

Expand Down
2 changes: 2 additions & 0 deletions lib/Twig/Compiler.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/
class Twig_Environment
{
const VERSION = '1.28.3';
const VERSION_ID = 12803;
const VERSION = '1.29.0-DEV';
const VERSION_ID = 12900;
const MAJOR_VERSION = 1;
const MINOR_VERSION = 28;
const RELEASE_VERSION = 3;
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
Original file line number Diff line number Diff line change
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 717365d

Please sign in to comment.