From ceefba6ae75305ee2b0cf328aab1ae014e222bc3 Mon Sep 17 00:00:00 2001 From: Michael Ueberschaer Date: Sun, 17 May 2015 17:31:38 +0200 Subject: [PATCH] fixed #2406 --- src/jcss.php | 14 +++++++++++++- src/lib/Zikula/Core.php | 14 +++++++++++++- src/lib/i18n/ZMO.php | 2 +- src/mo2json.php | 13 ++++++++++++- src/upgrade.php | 13 ++++++++++++- 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/jcss.php b/src/jcss.php index 519e35fb38..fac7d528de 100644 --- a/src/jcss.php +++ b/src/jcss.php @@ -13,7 +13,19 @@ */ include 'lib/bootstrap.php'; -ini_set('mbstring.internal_encoding', 'UTF-8'); + +/** + * mbstring.internal_encoding + * + * This feature has been deprecated as of PHP 5.6.0. Relying on this feature is highly discouraged. + * PHP 5.6 and later users should leave this empty and set default_charset instead. + * + * @link http://php.net/manual/en/mbstring.configuration.php#ini.mbstring.internal-encoding + */ +if (version_compare(\PHP_VERSION, '5.6.0', '<')) { + ini_set('mbstring.internal_encoding', 'UTF-8'); +} + ini_set('default_charset', 'UTF-8'); global $ZConfig; $f = (isset($_GET['f']) ? filter_var($_GET['f'], FILTER_SANITIZE_STRING) : false); diff --git a/src/lib/Zikula/Core.php b/src/lib/Zikula/Core.php index c06f93b16e..e644cc5970 100644 --- a/src/lib/Zikula/Core.php +++ b/src/lib/Zikula/Core.php @@ -23,7 +23,19 @@ define('ACCESS_ADD', 600); define('ACCESS_DELETE', 700); define('ACCESS_ADMIN', 800); -ini_set('mbstring.internal_encoding', 'UTF-8'); + +/** + * mbstring.internal_encoding + * + * This feature has been deprecated as of PHP 5.6.0. Relying on this feature is highly discouraged. + * PHP 5.6 and later users should leave this empty and set default_charset instead. + * + * @link http://php.net/manual/en/mbstring.configuration.php#ini.mbstring.internal-encoding + */ +if (version_compare(\PHP_VERSION, '5.6.0', '<')) { + ini_set('mbstring.internal_encoding', 'UTF-8'); +} + ini_set('default_charset', 'UTF-8'); mb_regex_encoding('UTF-8'); diff --git a/src/lib/i18n/ZMO.php b/src/lib/i18n/ZMO.php index 95c613f4b0..d0792bbf2c 100644 --- a/src/lib/i18n/ZMO.php +++ b/src/lib/i18n/ZMO.php @@ -165,7 +165,7 @@ public function __construct(StreamReader_Abstract $reader, $enable_cache = true) $this->total = $this->readint(); $this->originals = $this->readint(); $this->translations = $this->readint(); - $this->encoding = ini_get('mbstring.internal_encoding'); + $this->encoding = (version_compare(\PHP_VERSION, '5.6.0', '<')) ? ini_get('mbstring.internal_encoding') : ini_get('default_charset'); } /** diff --git a/src/mo2json.php b/src/mo2json.php index 4999d37229..a1c5a42e4e 100644 --- a/src/mo2json.php +++ b/src/mo2json.php @@ -12,7 +12,18 @@ * information regarding copyright and licensing. */ -ini_set('mbstring.internal_encoding', 'UTF-8'); +/** + * mbstring.internal_encoding + * + * This feature has been deprecated as of PHP 5.6.0. Relying on this feature is highly discouraged. + * PHP 5.6 and later users should leave this empty and set default_charset instead. + * + * @link http://php.net/manual/en/mbstring.configuration.php#ini.mbstring.internal-encoding + */ +if (version_compare(\PHP_VERSION, '5.6.0', '<')) { + ini_set('mbstring.internal_encoding', 'UTF-8'); +} + ini_set('default_charset', 'UTF-8'); mb_regex_encoding('UTF-8'); diff --git a/src/upgrade.php b/src/upgrade.php index 376c97cba7..e6fe0deb53 100755 --- a/src/upgrade.php +++ b/src/upgrade.php @@ -12,7 +12,18 @@ * information regarding copyright and licensing. */ -ini_set('mbstring.internal_encoding', 'UTF-8'); +/** + * mbstring.internal_encoding + * + * This feature has been deprecated as of PHP 5.6.0. Relying on this feature is highly discouraged. + * PHP 5.6 and later users should leave this empty and set default_charset instead. + * + * @link http://php.net/manual/en/mbstring.configuration.php#ini.mbstring.internal-encoding + */ +if (version_compare(\PHP_VERSION, '5.6.0', '<')) { + ini_set('mbstring.internal_encoding', 'UTF-8'); +} + ini_set('default_charset', 'UTF-8'); mb_regex_encoding('UTF-8'); ini_set('memory_limit', '64M');