From eb555ed7a1673dab9f51df0d1365d19c4429a900 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 12 Feb 2014 19:25:01 +0200 Subject: Move mbstring/iconv configuration and MB_ENABLED, ICONV_ENABLED out of CI_Utf8::__construct() Also, use mb_substitute_character() instead of ini_set() --- tests/Bootstrap.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index c98d88531..7f10ea1d6 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -40,6 +40,29 @@ isset($_SERVER['REMOTE_ADDR']) OR $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; // Prep our test environment include_once $dir.'/mocks/core/common.php'; include_once SYSTEM_PATH.'core/Common.php'; + + +if (extension_loaded('mbstring')) +{ + defined('MB_ENABLED') OR define('MB_ENABLED', TRUE); + mb_internal_encoding('UTF-8'); + mb_substitute_character('none'); +} +else +{ + defined('MB_ENABLED') OR define('MB_ENABLED', FALSE); +} + +if (extension_loaded('iconv')) +{ + defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE); + iconv_set_encoding('internal_encoding', 'UTF-8'); +} +else +{ + defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE); +} + include_once $dir.'/mocks/autoloader.php'; spl_autoload_register('autoload'); -- cgit v1.2.3-24-g4f1b From 3fd1b384273b7b6d56950bbad3e1fac18f5f82e4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 13 Feb 2014 03:01:31 +0200 Subject: Introducing compatibility layers - Limited support for mbstring (mb_strlen(), mb_strpos(), mb_substr() only) via iconv. Falls back to regular strlen(), strpos(), substr() if iconv is not available. - Password hashing, dependant on CRYPT_BLOWFISH (2y version, available since PHP 5.3.7) availability. --- tests/Bootstrap.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/Bootstrap.php') diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 7f10ea1d6..439c7fdab 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -63,6 +63,9 @@ else defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE); } +include_once SYSTEM_PATH.'core/compat/mbstring.php'; +include_once SYSTEM_PATH.'core/compat/password.php'; + include_once $dir.'/mocks/autoloader.php'; spl_autoload_register('autoload'); -- cgit v1.2.3-24-g4f1b