fix for php 5.6+ deprecating mbstring.internal_encoding in favor or default_charset

This commit is contained in:
Ralf Becker 2014-12-08 19:16:44 +00:00
parent 2feacbecb8
commit 2c71852545
2 changed files with 7 additions and 5 deletions

View File

@ -532,7 +532,8 @@ class db_backup
{
$charset = trim(substr($line,9));
// needed if mbstring.func_overload > 0, else eg. substr does not work with non ascii chars
@ini_set('mbstring.internal_encoding',$charset);
$ini_default_charset = version_compare(PHP_VERSION, '5.6', '<') ? 'mbstring.internal_encoding' : 'default_charset';
@ini_set($ini_default_charset, $charset);
// check if we really need to convert the charset, as it's not perfect and can do some damage
if ($convert_to_system_charset && !strcasecmp($this->schema_proc->system_charset, $charset))

View File

@ -86,11 +86,11 @@ class translation
*/
static $mbstring;
/**
* Internal encoding / charset of mbstring (if loaded)
* Internal encoding / charset of PHP / mbstring (if loaded)
*
* @var string
*/
static $mbstring_internal_encoding;
static $default_charset;
/**
* Application which translations have to be cached instance- and NOT tree-specific
@ -138,9 +138,10 @@ class translation
// we need to set our charset as mbstring.internal_encoding if mbstring.func_overlaod > 0
// else we get problems for a charset is different from the default utf-8
if (ini_get('mbstring.func_overload') && self::$mbstring_internal_encoding != $charset)
$ini_default_charset = version_compare(PHP_VERSION, '5.6', '<') ? 'mbstring.internal_encoding' : 'default_charset';
if (ini_get($ini_default_charset) && self::$default_charset != $charset)
{
ini_set('mbstring.internal_encoding',self::$mbstring_internal_encoding = $charset);
ini_set($ini_default_charset, self::$default_charset = $charset);
}
return $charset;
}