diff --git a/CHANGELOG.md b/CHANGELOG.md index 06b5ebd3..39164d18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Lexers and Parsers PHP files are no longer under version control, but generated from sources (.y and .plex) - Smarty now always runs in multibyte mode, using `symfony/polyfill-mbstring` if required. Please use the multibyte extension for optimal performance. +- Smarty no longer calls `mb_internal_encoding()` and doesn't check for deprecated `mbstring.func_overload` ini directive [#480](https://github.com/smarty-php/smarty/issues/480) ### Deprecated - `$smarty->getPluginsDir()` diff --git a/src/Compiler/Configfile.php b/src/Compiler/Configfile.php index 1eaedb9f..1d50e3f2 100644 --- a/src/Compiler/Configfile.php +++ b/src/Compiler/Configfile.php @@ -106,15 +106,6 @@ class Configfile extends BaseCompiler { ); /* @var ConfigfileParser $this->parser */ $this->parser = new ConfigfileParser($this->lex, $this); - if (function_exists('mb_internal_encoding') - && function_exists('ini_get') - && ((int)ini_get('mbstring.func_overload')) & 2 - ) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } else { - $mbEncoding = null; - } if ($this->smarty->_parserdebug) { $this->parser->PrintTrace(); } @@ -127,9 +118,6 @@ class Configfile extends BaseCompiler { } // finish parsing process $this->parser->doParse(0, 0); - if ($mbEncoding) { - mb_internal_encoding($mbEncoding); - } if ($this->smarty->debugging) { $this->smarty->getDebug()->end_compile($this->template); } diff --git a/src/Compiler/Template.php b/src/Compiler/Template.php index 74154020..dc60472f 100644 --- a/src/Compiler/Template.php +++ b/src/Compiler/Template.php @@ -1254,15 +1254,6 @@ class Template extends BaseCompiler { if ($isTemplateSource && $this->template->caching) { $this->parser->insertPhpCode("getCompiled()->nocache_hash = '{$this->nocache_hash}';\n?>\n"); } - if (function_exists('mb_internal_encoding') - && function_exists('ini_get') - && ((int)ini_get('mbstring.func_overload')) & 2 - ) { - $mbEncoding = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } else { - $mbEncoding = null; - } if ($this->smarty->_parserdebug) { $this->parser->PrintTrace(); $this->parser->lex->PrintTrace(); @@ -1277,9 +1268,6 @@ class Template extends BaseCompiler { } // finish parsing process $this->parser->doParse(0, 0); - if ($mbEncoding) { - mb_internal_encoding($mbEncoding); - } // check for unclosed tags if ($this->getTagStackCount() > 0) { // get stacked info diff --git a/src/Extension/DefaultExtension.php b/src/Extension/DefaultExtension.php index 569b4e86..2575c903 100644 --- a/src/Extension/DefaultExtension.php +++ b/src/Extension/DefaultExtension.php @@ -488,7 +488,7 @@ class DefaultExtension extends Base { * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration * * @param string $string characters to calculate unicode of - * @param string $encoding encoding of $string, if null mb_internal_encoding() is used + * @param string $encoding encoding of $string * * @return array sequence of unicodes * @author Rodney Rehm diff --git a/src/Smarty.php b/src/Smarty.php index 48fb0d47..bdf67ac0 100644 --- a/src/Smarty.php +++ b/src/Smarty.php @@ -531,9 +531,6 @@ class Smarty extends \Smarty\TemplateBase public function __construct() { - if (is_callable('mb_internal_encoding')) { - mb_internal_encoding(\Smarty\Smarty::$_CHARSET); - } $this->start_time = microtime(true); // Check if we're running on Windows \Smarty\Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';