moriyoshi Thu Jul 24 13:01:51 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/mbstring/tests mb_output_handler_pattern-01.phpt
mb_output_handler_pattern-02.phpt
mb_output_handler_pattern-03.phpt
mb_output_handler_pattern-04.phpt
mb_output_handler_pattern-05.phpt
mb_output_handler_pattern-06.phpt
mb_output_handler_pattern-07.phpt
mb_output_handler_pattern-08.phpt
mb_output_handler_pattern-09.phpt
mb_output_handler_pattern-10.phpt
mb_output_handler_pattern-11.phpt
mb_output_handler_pattern-12.phpt
mb_output_handler_runtime_ini_alteration-01.phpt
mb_output_handler_runtime_ini_alteration-02.phpt
Modified files:
/php-src NEWS
/php-src/ext/mbstring config.m4 mbstring.c mbstring.h
Log:
- MFH: Added "mbstring.http_output_conv_mimetypes" INI directive.
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.216&r2=1.2027.2.547.2.965.2.217&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.216
php-src/NEWS:1.2027.2.547.2.965.2.217
--- php-src/NEWS:1.2027.2.547.2.965.2.216 Thu Jul 24 09:12:45 2008
+++ php-src/NEWS Thu Jul 24 13:01:49 2008
@@ -101,6 +101,11 @@
. Added support for OpenSSL digest and cipher functions.
. Added access to internal values of DSA, RSA and DH keys.
+- Improved mbstring extension:
+ . Added "mbstring.http_output_conv_mimetypes" INI directive that allows
+ common non-text types such as "application/xhtml+xml" to be converted
+ by mb_output_handler(). (Moriyoshi)
+
- Improved SOAP extension:
. Added support for element names in context of XMLShema's <any>. (Dmitry)
. Added ability to use Traversable objects instead of plain arrays.
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/config.m4?r1=1.58.2.4.2.11.2.5&r2=1.58.2.4.2.11.2.6&diff_format=u
Index: php-src/ext/mbstring/config.m4
diff -u php-src/ext/mbstring/config.m4:1.58.2.4.2.11.2.5
php-src/ext/mbstring/config.m4:1.58.2.4.2.11.2.6
--- php-src/ext/mbstring/config.m4:1.58.2.4.2.11.2.5 Wed Jul 16 02:30:48 2008
+++ php-src/ext/mbstring/config.m4 Thu Jul 24 13:01:49 2008
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.58.2.4.2.11.2.5 2008/07/16 02:30:48 moriyoshi Exp $
+dnl $Id: config.m4,v 1.58.2.4.2.11.2.6 2008/07/24 13:01:49 moriyoshi Exp $
dnl
AC_DEFUN([PHP_MBSTRING_ADD_SOURCES], [
@@ -111,6 +111,7 @@
AC_DEFINE([HAVE_STDARG_PROTOTYPES], [1], [Define to 1 if you have the
<stdarg.h> header file.])
], [])
AC_DEFINE([PHP_ONIG_BUNDLED], [1], [Define to 1 if the bundled oniguruma
is used])
+ AC_DEFINE([HAVE_ONIG], [1], [Define to 1 if the oniguruma library is
available])
PHP_MBSTRING_ADD_CFLAG([-DNOT_RUBY])
PHP_MBSTRING_ADD_BUILD_DIR([oniguruma])
PHP_MBSTRING_ADD_BUILD_DIR([oniguruma/enc])
@@ -170,6 +171,7 @@
PHP_CHECK_LIBRARY(onig, onig_init, [
PHP_ADD_LIBRARY_WITH_PATH(onig, $PHP_ONIG/$PHP_LIBDIR,
MBSTRING_SHARED_LIBADD)
+ AC_DEFINE([HAVE_ONIG], [1], [Define to 1 if the oniguruma library is
available])
],[
AC_MSG_ERROR([Problem with oniguruma. Please check config.log for more
information.])
], [
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.19&r2=1.224.2.22.2.25.2.20&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.19
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.20
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.19 Thu Jul 17
20:04:05 2008
+++ php-src/ext/mbstring/mbstring.c Thu Jul 24 13:01:49 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.224.2.22.2.25.2.19 2008/07/17 20:04:05 moriyoshi Exp $
*/
+/* $Id: mbstring.c,v 1.224.2.22.2.25.2.20 2008/07/24 13:01:49 moriyoshi Exp $
*/
/*
* PHP 4 Multibyte String module "mbstring"
@@ -81,9 +81,17 @@
#include "zend_multibyte.h"
#endif /* ZEND_MULTIBYTE */
-#if HAVE_MBSTRING
+#if HAVE_ONIG
+#include "php_onig_compat.h"
+#include <oniguruma.h>
+#undef UChar
+#elif HAVE_PCRE || HAVE_BUNDLED_PCRE
+#include <pcre.h>
+#endif
/* }}} */
+#if HAVE_MBSTRING
+
/* {{{ prototypes */
ZEND_DECLARE_MODULE_GLOBALS(mbstring)
static PHP_GINIT_FUNCTION(mbstring);
@@ -900,6 +908,79 @@
}
/* }}} */
+static void *_php_mb_compile_regex(const char *pattern TSRMLS_DC);
+static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len);
+static void _php_mb_free_regex(void *opaque);
+
+#if HAVE_ONIG
+/* {{{ _php_mb_compile_regex */
+void *_php_mb_compile_regex(const char *pattern TSRMLS_DC)
+{
+ php_mb_regex_t *retval;
+ OnigErrorInfo err_info;
+ int err_code;
+
+ if ((err_code = onig_new(&retval,
+ (const OnigUChar *)pattern,
+ (const OnigUChar *)pattern + strlen(pattern),
+ ONIG_OPTION_IGNORECASE | ONIG_OPTION_DONT_CAPTURE_GROUP,
+ ONIG_ENCODING_ASCII, &OnigSyntaxPerl, &err_info))) {
+ OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(err_str, err_code, err_info);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: %s", pattern,
err_str);
+ retval = NULL;
+ }
+ return retval;
+}
+/* }}} */
+
+/* {{{ _php_mb_match_regex */
+int _php_mb_match_regex(void *opaque, const char *str, size_t str_len)
+{
+ return onig_search((php_mb_regex_t *)opaque, (const OnigUChar *)str,
+ (const OnigUChar*)str + str_len, (const OnigUChar *)str,
+ (const OnigUChar*)str + str_len, NULL,
ONIG_OPTION_NONE) >= 0;
+}
+/* }}} */
+
+/* {{{ _php_mb_free_regex */
+void _php_mb_free_regex(void *opaque)
+{
+ onig_free((php_mb_regex_t *)opaque);
+}
+/* }}} */
+#elif HAVE_PCRE || HAVE_BUNDLED_PCRE
+/* {{{ _php_mb_compile_regex */
+void *_php_mb_compile_regex(const char *pattern TSRMLS_DC)
+{
+ pcre *retval;
+ const char *err_str;
+ int err_offset;
+
+ if (!(retval = pcre_compile(pattern,
+ PCRE_CASELESS, &err_str, &err_offset, NULL))) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s (offset=%d):
%s", pattern, err_offset, err_str);
+ }
+ return retval;
+}
+/* }}} */
+
+/* {{{ _php_mb_match_regex */
+int _php_mb_match_regex(void *opaque, const char *str, size_t str_len)
+{
+ return pcre_exec((pcre *)opaque, NULL, str, (int)str_len, 0,
+ 0, NULL, 0) >= 0;
+}
+/* }}} */
+
+/* {{{ _php_mb_free_regex */
+void _php_mb_free_regex(void *opaque)
+{
+ pcre_free(opaque);
+}
+/* }}} */
+#endif
+
/* {{{ php_mb_nls_get_default_detect_order_list */
static int php_mb_nls_get_default_detect_order_list(enum mbfl_no_language
lang, enum mbfl_no_encoding **plist, int* plist_size)
{
@@ -920,6 +1001,7 @@
/* }}} */
/* {{{ php.ini directive handler */
+/* {{{ static PHP_INI_MH(OnUpdate_mbstring_language) */
static PHP_INI_MH(OnUpdate_mbstring_language)
{
enum mbfl_no_language no_language;
@@ -1105,26 +1187,63 @@
}
/* }}} */
+/* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes */
+static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes)
+{
+ zval tmp;
+ void *re = NULL;
+
+ if (!new_value) {
+ return SUCCESS;
+ }
+ php_trim(new_value, new_value_length, NULL, 0, &tmp, 3 TSRMLS_CC);
+
+ if (Z_STRLEN(tmp) > 0) {
+ if (!(re = _php_mb_compile_regex(Z_STRVAL(tmp) TSRMLS_CC))) {
+ zval_dtor(&tmp);
+ return FAILURE;
+ }
+ }
+
+ if (MBSTRG(http_output_conv_mimetypes)) {
+ _php_mb_free_regex(MBSTRG(http_output_conv_mimetypes));
+ }
+
+ MBSTRG(http_output_conv_mimetypes) = re;
+
+ zval_dtor(&tmp);
+ return SUCCESS;
+}
+/* }}} */
+/* }}} */
+
/* {{{ php.ini directive registration */
PHP_INI_BEGIN()
- PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_SYSTEM |
PHP_INI_PERDIR, OnUpdate_mbstring_language)
- PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL,
OnUpdate_mbstring_detect_order)
- PHP_INI_ENTRY("mbstring.http_input", "pass", PHP_INI_ALL,
OnUpdate_mbstring_http_input)
- PHP_INI_ENTRY("mbstring.http_output", "pass", PHP_INI_ALL,
OnUpdate_mbstring_http_output)
- PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL,
OnUpdate_mbstring_internal_encoding)
+ PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_SYSTEM |
PHP_INI_PERDIR, OnUpdate_mbstring_language)
+ PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL,
OnUpdate_mbstring_detect_order)
+ PHP_INI_ENTRY("mbstring.http_input", "pass", PHP_INI_ALL,
OnUpdate_mbstring_http_input)
+ PHP_INI_ENTRY("mbstring.http_output", "pass", PHP_INI_ALL,
OnUpdate_mbstring_http_output)
+ PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL,
OnUpdate_mbstring_internal_encoding)
#ifdef ZEND_MULTIBYTE
- PHP_INI_ENTRY("mbstring.script_encoding", NULL, PHP_INI_ALL,
OnUpdate_mbstring_script_encoding)
+ PHP_INI_ENTRY("mbstring.script_encoding", NULL, PHP_INI_ALL,
OnUpdate_mbstring_script_encoding)
#endif /* ZEND_MULTIBYTE */
- PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL,
OnUpdate_mbstring_substitute_character)
- STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
- PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals,
mbstring_globals)
-
- STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0",
- PHP_INI_SYSTEM | PHP_INI_PERDIR,
OnUpdate_mbstring_encoding_translation,
- encoding_translation, zend_mbstring_globals, mbstring_globals)
-
- STD_PHP_INI_BOOLEAN("mbstring.strict_detection", "0",
- PHP_INI_ALL, OnUpdateLong, strict_detection, zend_mbstring_globals,
mbstring_globals)
+ PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL,
OnUpdate_mbstring_substitute_character)
+ STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
+ PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals,
mbstring_globals)
+
+ STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0",
+ PHP_INI_SYSTEM | PHP_INI_PERDIR,
+ OnUpdate_mbstring_encoding_translation,
+ encoding_translation, zend_mbstring_globals, mbstring_globals)
+ PHP_INI_ENTRY("mbstring.http_output_conv_mimetypes",
+ "^(text/|application/xhtml\\+xml)",
+ PHP_INI_ALL,
+ OnUpdate_mbstring_http_output_conv_mimetypes)
+
+ STD_PHP_INI_BOOLEAN("mbstring.strict_detection", "0",
+ PHP_INI_ALL,
+ OnUpdateLong,
+ strict_detection, zend_mbstring_globals, mbstring_globals)
PHP_INI_END()
/* }}} */
@@ -1163,6 +1282,7 @@
mbstring_globals->encoding_translation = 0;
mbstring_globals->strict_detection = 0;
mbstring_globals->outconv = NULL;
+ mbstring_globals->http_output_conv_mimetypes = NULL;
#if HAVE_MBREGEX
mbstring_globals->mb_regex_globals =
php_mb_regex_globals_alloc(TSRMLS_C);
#endif
@@ -1172,6 +1292,20 @@
/* {{{ PHP_GSHUTDOWN_FUNCTION */
static PHP_GSHUTDOWN_FUNCTION(mbstring)
{
+ if (mbstring_globals->http_input_list) {
+ free(mbstring_globals->http_input_list);
+ }
+#ifdef ZEND_MULTIBYTE
+ if (mbstring_globals->script_encoding_list) {
+ free(mbstring_globals->script_encoding_list);
+ }
+#endif /* ZEND_MULTIBYTE */
+ if (mbstring_globals->detect_order_list) {
+ free(mbstring_globals->detect_order_list);
+ }
+ if (mbstring_globals->http_output_conv_mimetypes) {
+
_php_mb_free_regex(mbstring_globals->http_output_conv_mimetypes);
+ }
#if HAVE_MBREGEX
php_mb_regex_globals_free(mbstring_globals->mb_regex_globals TSRMLS_CC);
#endif
@@ -1210,18 +1344,6 @@
{
UNREGISTER_INI_ENTRIES();
- if (MBSTRG(http_input_list)) {
- free(MBSTRG(http_input_list));
- }
-#ifdef ZEND_MULTIBYTE
- if (MBSTRG(script_encoding_list)) {
- free(MBSTRG(script_encoding_list));
- }
-#endif /* ZEND_MULTIBYTE */
- if (MBSTRG(detect_order_list)) {
- free(MBSTRG(detect_order_list));
- }
-
#if HAVE_MBREGEX
PHP_MSHUTDOWN(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
#endif
@@ -1402,9 +1524,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "Multibyte Support", "enabled");
php_info_print_table_row(2, "Multibyte string engine", "libmbfl");
- if (MBSTRG(encoding_translation)) {
- php_info_print_table_row(2, "HTTP input encoding translation",
"enabled");
- }
+ php_info_print_table_row(2, "HTTP input encoding translation",
MBSTRG(encoding_translation) ? "enabled": "disabled");
php_info_print_table_end();
php_info_print_table_start();
@@ -1839,8 +1959,11 @@
}
/* analyze mime type */
- if (SG(sapi_headers).mimetype &&
- strncmp(SG(sapi_headers).mimetype, "text/", 5) == 0) {
+ if (SG(sapi_headers).mimetype &&
+ _php_mb_match_regex(
+ MBSTRG(http_output_conv_mimetypes),
+ SG(sapi_headers).mimetype,
+ strlen(SG(sapi_headers).mimetype))) {
if ((s = strchr(SG(sapi_headers).mimetype,';')) ==
NULL){
mimetype = estrdup(SG(sapi_headers).mimetype);
} else {
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.h?r1=1.66.2.4.2.5.2.3&r2=1.66.2.4.2.5.2.4&diff_format=u
Index: php-src/ext/mbstring/mbstring.h
diff -u php-src/ext/mbstring/mbstring.h:1.66.2.4.2.5.2.3
php-src/ext/mbstring/mbstring.h:1.66.2.4.2.5.2.4
--- php-src/ext/mbstring/mbstring.h:1.66.2.4.2.5.2.3 Thu Jul 17 16:08:37 2008
+++ php-src/ext/mbstring/mbstring.h Thu Jul 24 13:01:50 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.h,v 1.66.2.4.2.5.2.3 2008/07/17 16:08:37 moriyoshi Exp $ */
+/* $Id: mbstring.h,v 1.66.2.4.2.5.2.4 2008/07/24 13:01:50 moriyoshi Exp $ */
/*
* PHP 4 Multibyte String module "mbstring" (currently only for Japanese)
@@ -193,6 +193,7 @@
long strict_detection;
long illegalchars;
mbfl_buffer_converter *outconv;
+ void *http_output_conv_mimetypes;
#if HAVE_MBREGEX
struct _zend_mb_regex_globals *mb_regex_globals;
#endif
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-01.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-01.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-01.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: text/html");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-02.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-02.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-02.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: text/plain");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-03.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-03.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-03.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: application/xhtml+xml");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-04.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-04.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-04.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: application/octet-stream");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(18) "e38386e382b9e38388"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-05.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-05.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-05.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-06.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-06.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-06.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: text/html");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-07.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-07.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-07.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
mbstring.http_output_content_type_regex=html
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: text/html");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-08.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-08.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-08.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
mbstring.http_output_content_type_regex=html
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: text/plain");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(18) "e38386e382b9e38388"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-09.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-09.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-09.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
mbstring.http_output_content_type_regex=html
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: application/xhtml+xml");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-10.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-10.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-10.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
mbstring.http_output_content_type_regex=html
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: application/octet-stream");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(18) "e38386e382b9e38388"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-11.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-11.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-11.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_pattern-12.phpt?view=markup&rev=1.1
Index: php-src/ext/mbstring/tests/mb_output_handler_pattern-12.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_pattern-12.phpt
--TEST--
mb_output_handler() patterns
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
--FILE--
<?php
mb_http_output("EUC-JP");
header("Content-Type: text/html");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt?view=markup&rev=1.1
Index:
php-src/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt
--TEST--
mb_output_handler() and mbstring.http_output_content_type_regex alteration in
runtime (1)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
mbstring.http_output_content_type_regex=plain
--FILE--
<?php
mb_http_output("EUC-JP");
ini_set('mbstring.http_output_content_type_regex', 'text');
header("Content-Type: text/html");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(12) "a5c6a5b9a5c8"
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-02.phpt?view=markup&rev=1.1
Index:
php-src/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-02.phpt
+++ php-src/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-02.phpt
--TEST--
mb_output_handler() and mbstring.http_output_content_type_regex alteration in
runtime (2)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
mbstring.internal_encoding=UTF-8
mbstring.http_output_content_type_regex=html
--FILE--
<?php
mb_http_output("EUC-JP");
ini_set('mbstring.http_output_content_type_regex', 'application');
header("Content-Type: text/html");
ob_start();
ob_start('mb_output_handler');
echo "ãã¹ã";
ob_end_flush();
var_dump(bin2hex(ob_get_clean()));
?>
--EXPECT--
string(18) "e38386e382b9e38388"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php