moriyoshi Tue Feb 17 16:29:59 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/mbstring/tests mb_get_info.phpt
Modified files:
/php-src/ext/mbstring mbstring.c
Log:
- MFH: Add an entry for http_output_conv_mimetypes to the output of
mb_get_info(). (patch by T. Komura, thanks!)
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.49&r2=1.224.2.22.2.25.2.50&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.49
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.50
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.49 Sun Feb 15
07:11:04 2009
+++ php-src/ext/mbstring/mbstring.c Tue Feb 17 16:29:59 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.224.2.22.2.25.2.49 2009/02/15 07:11:04 moriyoshi Exp $
*/
+/* $Id: mbstring.c,v 1.224.2.22.2.25.2.50 2009/02/17 16:29:59 moriyoshi Exp $
*/
/*
* PHP 4 Multibyte String module "mbstring"
@@ -4314,6 +4314,9 @@
if ((name = (char
*)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) {
add_assoc_string(return_value, "http_output", name, 1);
}
+ if ((name = (char
*)zend_ini_string("mbstring.http_output_conv_mimetypes",
sizeof("mbstring.http_output_conv_mimetypes"), 0)) != NULL) {
+ add_assoc_string(return_value,
"http_output_conv_mimetypes", name, 1);
+ }
add_assoc_long(return_value, "func_overload",
MBSTRG(func_overload));
if (MBSTRG(func_overload)){
over_func = &(mb_ovld[0]);
@@ -4405,6 +4408,10 @@
if ((name = (char
*)mbfl_no_encoding2name(MBSTRG(current_http_output_encoding))) != NULL) {
RETVAL_STRING(name, 1);
}
+ } else if (!strcasecmp("http_output_conv_mimetypes", typ)) {
+ if ((name = (char
*)zend_ini_string("mbstring.http_output_conv_mimetypes",
sizeof("mbstring.http_output_conv_mimetypes"), 0)) != NULL) {
+ RETVAL_STRING(name, 1);
+ }
} else if (!strcasecmp("func_overload", typ)) {
RETVAL_LONG(MBSTRG(func_overload));
} else if (!strcasecmp("func_overload_list", typ)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_get_info.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_get_info.phpt
+++ php-src/ext/mbstring/tests/mb_get_info.phpt
--TEST--
Test mb_get_info() function
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip'); ?>
--INI--
mbstring.encoding_translation=1
mbstring.language=Korean
mbstring.internal_encoding=UTF-8
mbstring.http_input=ISO-8859-1
mbstring.http_output=ISO-8859-15
mbstring.http_output_conv_mimetypes=abc
mbstring.func_overload=2
mbstring.detect_order=UTF-8,ISO-8859-15,ISO-8859-1,ASCII
mbstring.substitute_character=123
mbstring.strict_detection=1
--FILE--
<?php
mb_parse_str("abc=def", $dummy);
mb_convert_encoding("\xff\xff", "Shift_JIS", "UCS-2BE");
$result = mb_get_info();
var_dump($result);
foreach (array_keys($result) as $key) {
var_dump($result[$key], mb_get_info($key));
}
?>
--EXPECT--
array(15) {
["internal_encoding"]=>
string(5) "UTF-8"
["http_input"]=>
string(10) "ISO-8859-1"
["http_output"]=>
string(11) "ISO-8859-15"
["http_output_conv_mimetypes"]=>
string(3) "abc"
["func_overload"]=>
int(2)
["func_overload_list"]=>
array(12) {
["strlen"]=>
string(9) "mb_strlen"
["strpos"]=>
string(9) "mb_strpos"
["strrpos"]=>
string(10) "mb_strrpos"
["stripos"]=>
string(10) "mb_stripos"
["strripos"]=>
string(11) "mb_strripos"
["strstr"]=>
string(9) "mb_strstr"
["strrchr"]=>
string(10) "mb_strrchr"
["stristr"]=>
string(10) "mb_stristr"
["substr"]=>
string(9) "mb_substr"
["strtolower"]=>
string(13) "mb_strtolower"
["strtoupper"]=>
string(13) "mb_strtoupper"
["substr_count"]=>
string(15) "mb_substr_count"
}
["mail_charset"]=>
string(11) "ISO-2022-KR"
["mail_header_encoding"]=>
string(6) "BASE64"
["mail_body_encoding"]=>
string(4) "7bit"
["illegal_chars"]=>
int(1)
["encoding_translation"]=>
string(2) "On"
["language"]=>
string(6) "Korean"
["detect_order"]=>
array(4) {
[0]=>
string(5) "UTF-8"
[1]=>
string(11) "ISO-8859-15"
[2]=>
string(10) "ISO-8859-1"
[3]=>
string(5) "ASCII"
}
["substitute_character"]=>
int(123)
["strict_detection"]=>
string(2) "On"
}
string(5) "UTF-8"
string(5) "UTF-8"
string(10) "ISO-8859-1"
string(10) "ISO-8859-1"
string(11) "ISO-8859-15"
string(11) "ISO-8859-15"
string(3) "abc"
string(3) "abc"
int(2)
int(2)
array(12) {
["strlen"]=>
string(9) "mb_strlen"
["strpos"]=>
string(9) "mb_strpos"
["strrpos"]=>
string(10) "mb_strrpos"
["stripos"]=>
string(10) "mb_stripos"
["strripos"]=>
string(11) "mb_strripos"
["strstr"]=>
string(9) "mb_strstr"
["strrchr"]=>
string(10) "mb_strrchr"
["stristr"]=>
string(10) "mb_stristr"
["substr"]=>
string(9) "mb_substr"
["strtolower"]=>
string(13) "mb_strtolower"
["strtoupper"]=>
string(13) "mb_strtoupper"
["substr_count"]=>
string(15) "mb_substr_count"
}
array(12) {
["strlen"]=>
string(9) "mb_strlen"
["strpos"]=>
string(9) "mb_strpos"
["strrpos"]=>
string(10) "mb_strrpos"
["stripos"]=>
string(10) "mb_stripos"
["strripos"]=>
string(11) "mb_strripos"
["strstr"]=>
string(9) "mb_strstr"
["strrchr"]=>
string(10) "mb_strrchr"
["stristr"]=>
string(10) "mb_stristr"
["substr"]=>
string(9) "mb_substr"
["strtolower"]=>
string(13) "mb_strtolower"
["strtoupper"]=>
string(13) "mb_strtoupper"
["substr_count"]=>
string(15) "mb_substr_count"
}
string(11) "ISO-2022-KR"
string(11) "ISO-2022-KR"
string(6) "BASE64"
string(6) "BASE64"
string(4) "7bit"
string(4) "7bit"
int(1)
int(1)
string(2) "On"
string(2) "On"
string(6) "Korean"
string(6) "Korean"
array(4) {
[0]=>
string(5) "UTF-8"
[1]=>
string(11) "ISO-8859-15"
[2]=>
string(10) "ISO-8859-1"
[3]=>
string(5) "ASCII"
}
array(4) {
[0]=>
string(5) "UTF-8"
[1]=>
string(11) "ISO-8859-15"
[2]=>
string(10) "ISO-8859-1"
[3]=>
string(5) "ASCII"
}
int(123)
int(123)
string(2) "On"
string(2) "On"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php