Only check for mbstring.func_overload in < PHP 8.x

Fixes #385
This commit is contained in:
Justin Hileman
2022-01-07 21:35:06 -05:00
parent 26c8a448fc
commit e7165a33b2
+8 -3
View File
@@ -97,11 +97,16 @@ class Mustache_Tokenizer
// Setting mbstring.func_overload makes things *really* slow. // Setting mbstring.func_overload makes things *really* slow.
// Let's do everyone a favor and scan this string as ASCII instead. // Let's do everyone a favor and scan this string as ASCII instead.
// //
// The INI directive was removed in PHP 8.0 so we don't need to check there (and can drop it
// when we remove support for older versions of PHP).
//
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$encoding = null; $encoding = null;
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) { if (version_compare(PHP_VERSION, '8.0.0', '<')) {
$encoding = mb_internal_encoding(); if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
mb_internal_encoding('ASCII'); $encoding = mb_internal_encoding();
mb_internal_encoding('ASCII');
}
} }
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd