cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c
| From: | Moriyoshi Koizumi | Date: | Sun, 03 Aug 2008 00:04:17 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/mbstring mbstring.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-51912@lists.php.net to get a copy of this message | ||
moriyoshi Sun Aug 3 00:04:17 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/mbstring mbstring.c
Log:
- MFH: Forgot to take account of the case when mbstring.language is processed
afterwards.
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.26&r2=1.224.2.22.2.25.2.27&diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.26
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.27
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.26 Sat Aug 2 20:49:00 2008
+++ php-src/ext/mbstring/mbstring.c Sun Aug 3 00:04:17 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.224.2.22.2.25.2.26 2008/08/02 20:49:00 moriyoshi Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.25.2.27 2008/08/03 00:04:17 moriyoshi Exp $ */
/*
* PHP 4 Multibyte String module "mbstring"
@@ -1250,8 +1250,8 @@
}
/* }}} */
-/* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */
-static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
+/* {{{ static _php_mb_ini_mbstring_internal_encoding_set */
+static int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint new_value_length
TSRMLS_DC)
{
enum mbfl_no_encoding no_encoding;
const char *enc_name = NULL;
@@ -1324,6 +1324,23 @@
}
/* }}} */
+/* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */
+static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
+{
+ if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN) {
+ return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC);
+ } else {
+ // the corresponding mbstring globals needs to be set according to the
+ // ini value in the later stage because it never falls back to the
+ // default value if 1. no value for mbstring.internal_encoding is given,
+ // 2. mbstring.language directive is processed in per-dir or runtime
+ // context and 3. call to the handler for mbstring.language is done
+ // after mbstring.internal_encoding is handled.
+ return SUCCESS;
+ }
+}
+/* }}} */
+
#ifdef ZEND_MULTIBYTE
/* {{{ static PHP_INI_MH(OnUpdate_mbstring_script_encoding) */
static PHP_INI_MH(OnUpdate_mbstring_script_encoding)
@@ -1577,8 +1594,10 @@
zend_function *func, *orig;
const struct mb_overload_def *p;
- php_mb_nls_get_default_detect_order_list(MBSTRG(language),
- &MBSTRG(default_detect_order_list), &MBSTRG(default_detect_order_list_size));
+ {
+ char *value = zend_ini_string("mbstring.internal_encoding",
sizeof("mbstring.internal_encoding"), 0);
+ _php_mb_ini_mbstring_internal_encoding_set(value, value ? strlen(value): 0 TSRMLS_CC);
+ }
MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding);
MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding);