diff options
Diffstat (limited to 'ext/mbstring')
31 files changed, 55 insertions, 954 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index bf71270452..4ca947374e 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -182,25 +182,6 @@ static const php_mb_nls_ident_list php_mb_default_identify_list[] = { /* }}} */ -/* {{{ mb_overload_def mb_ovld[] */ -static const struct mb_overload_def mb_ovld[] = { - {MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"}, - {MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"}, - {MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strpos"}, - {MB_OVERLOAD_STRING, "strrpos", "mb_strrpos", "mb_orig_strrpos"}, - {MB_OVERLOAD_STRING, "stripos", "mb_stripos", "mb_orig_stripos"}, - {MB_OVERLOAD_STRING, "strripos", "mb_strripos", "mb_orig_strripos"}, - {MB_OVERLOAD_STRING, "strstr", "mb_strstr", "mb_orig_strstr"}, - {MB_OVERLOAD_STRING, "strrchr", "mb_strrchr", "mb_orig_strrchr"}, - {MB_OVERLOAD_STRING, "stristr", "mb_stristr", "mb_orig_stristr"}, - {MB_OVERLOAD_STRING, "substr", "mb_substr", "mb_orig_substr"}, - {MB_OVERLOAD_STRING, "strtolower", "mb_strtolower", "mb_orig_strtolower"}, - {MB_OVERLOAD_STRING, "strtoupper", "mb_strtoupper", "mb_orig_strtoupper"}, - {MB_OVERLOAD_STRING, "substr_count", "mb_substr_count", "mb_orig_substr_count"}, - {0, NULL, NULL, NULL} -}; -/* }}} */ - /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0) ZEND_ARG_INFO(0, language) @@ -230,7 +211,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1) ZEND_ARG_INFO(0, encoding) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 2) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() @@ -1474,8 +1455,6 @@ PHP_INI_BEGIN() PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output) STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, 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, @@ -1544,7 +1523,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); mbstring_globals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; mbstring_globals->current_filter_illegal_substchar = 0x3f; /* '?' */ mbstring_globals->illegalchars = 0; - mbstring_globals->func_overload = 0; mbstring_globals->encoding_translation = 0; mbstring_globals->strict_detection = 0; mbstring_globals->outconv = NULL; @@ -1601,10 +1579,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); sapi_register_post_entries(mbstr_post_entries); } - REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT); @@ -1630,39 +1604,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); php_mb_rfc1867_getword_conf, php_mb_rfc1867_basename); - /* override original function (deprecated). */ - if (MBSTRG(func_overload)){ - zend_function *func, *orig; - const struct mb_overload_def *p; - zend_string *str; - - p = &(mb_ovld[0]); - while (p->type > 0) { - if ((MBSTRG(func_overload) & p->type) == p->type && - !zend_hash_str_exists(CG(function_table), p->save_func, strlen(p->save_func)) - ) { - func = zend_hash_str_find_ptr(CG(function_table), p->ovld_func, strlen(p->ovld_func)); - - if ((orig = zend_hash_str_find_ptr(CG(function_table), p->orig_func, strlen(p->orig_func))) == NULL) { - php_error_docref("ref.mbstring", E_WARNING, "mbstring couldn't find function %s.", p->orig_func); - return FAILURE; - } else { - ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION); - str = zend_string_init_interned(p->save_func, strlen(p->save_func), 1); - zend_hash_add_mem(CG(function_table), str, orig, sizeof(zend_internal_function)); - zend_string_release_ex(str, 1); - function_add_ref(orig); - - str = zend_string_init_interned(p->orig_func, strlen(p->orig_func), 1); - zend_hash_update_mem(CG(function_table), str, func, sizeof(zend_internal_function)); - zend_string_release_ex(str, 1); - function_add_ref(func); - } - } - p++; - } - } - return SUCCESS; } /* }}} */ @@ -1670,24 +1611,6 @@ ZEND_TSRMLS_CACHE_UPDATE(); /* {{{ PHP_MSHUTDOWN_FUNCTION(mbstring) */ PHP_MSHUTDOWN_FUNCTION(mbstring) { - /* clear overloaded function. */ - if (MBSTRG(func_overload)){ - const struct mb_overload_def *p; - zend_function *orig; - - p = &(mb_ovld[0]); - while (p->type > 0) { - if ((MBSTRG(func_overload) & p->type) == p->type && - (orig = zend_hash_str_find_ptr(CG(function_table), p->save_func, strlen(p->save_func)))) { - - zend_hash_str_update_mem(CG(function_table), p->orig_func, strlen(p->orig_func), orig, sizeof(zend_internal_function)); - function_add_ref(orig); - zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func)); - } - p++; - } - } - UNREGISTER_INI_ENTRIES(); zend_multibyte_restore_functions(); @@ -1714,12 +1637,6 @@ PHP_RINIT_FUNCTION(mbstring) php_mb_populate_current_detect_order_list(); - /* override original function. */ - if (MBSTRG(func_overload)){ - zend_error(E_DEPRECATED, "The mbstring.func_overload directive is deprecated"); - - CG(compiler_options) |= ZEND_COMPILE_NO_BUILTIN_STRLEN; - } #if HAVE_MBREGEX PHP_RINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU); #endif @@ -2140,26 +2057,24 @@ PHP_FUNCTION(mb_preferred_mime_name) #define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0) #define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0) -/* {{{ proto bool mb_parse_str(string encoded_string [, array result]) +/* {{{ proto bool mb_parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(mb_parse_str) { - zval *track_vars_array = NULL; - char *encstr = NULL; + zval *track_vars_array; + char *encstr; size_t encstr_len; php_mb_encoding_handler_info_t info; const mbfl_encoding *detected; track_vars_array = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &encstr, &encstr_len, &track_vars_array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &encstr, &encstr_len, &track_vars_array) == FAILURE) { return; } - if (track_vars_array != NULL) { - track_vars_array = zend_try_array_init(track_vars_array); - if (!track_vars_array) { - return; - } + track_vars_array = zend_try_array_init(track_vars_array); + if (!track_vars_array) { + return; } encstr = estrndup(encstr, encstr_len); @@ -2173,22 +2088,7 @@ PHP_FUNCTION(mb_parse_str) info.num_from_encodings = MBSTRG(http_input_list_size); info.from_language = MBSTRG(language); - if (track_vars_array != NULL) { - detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr); - } else { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("mb_parse_str() with a single argument") == FAILURE) { - efree(encstr); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling mb_parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr); - } + detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr); MBSTRG(http_input_identify) = detected; @@ -2969,11 +2869,6 @@ PHP_FUNCTION(mb_substr) real_len = 0; } - if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING) - && (real_from > mbfl_strlen(&string))) { - RETURN_FALSE; - } - ret = mbfl_substr(&string, &result, real_from, real_len); if (NULL == ret) { RETURN_FALSE; @@ -4615,8 +4510,7 @@ PHP_FUNCTION(mb_get_info) size_t typ_len; size_t n; char *name; - const struct mb_overload_def *over_func; - zval row1, row2; + zval row; const mbfl_language *lang = mbfl_no2language(MBSTRG(language)); const mbfl_encoding **entry; @@ -4638,20 +4532,6 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { add_assoc_string(return_value, "http_output_conv_mimetypes", name); } - add_assoc_long(return_value, "func_overload", MBSTRG(func_overload)); - if (MBSTRG(func_overload)){ - over_func = &(mb_ovld[0]); - array_init(&row1); - while (over_func->type > 0) { - if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func); - } - over_func++; - } - add_assoc_zval(return_value, "func_overload_list", &row1); - } else { - add_assoc_string(return_value, "func_overload_list", "no overload"); - } if (lang != NULL) { if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { add_assoc_string(return_value, "mail_charset", name); @@ -4676,12 +4556,12 @@ PHP_FUNCTION(mb_get_info) entry = MBSTRG(current_detect_order_list); if (n > 0) { size_t i; - array_init(&row2); + array_init(&row); for (i = 0; i < n; i++) { - add_next_index_string(&row2, (*entry)->name); + add_next_index_string(&row, (*entry)->name); entry++; } - add_assoc_zval(return_value, "detect_order", &row2); + add_assoc_zval(return_value, "detect_order", &row); } if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { add_assoc_string(return_value, "substitute_character", "none"); @@ -4713,21 +4593,6 @@ PHP_FUNCTION(mb_get_info) if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) { RETVAL_STRING(name); } - } else if (!strcasecmp("func_overload", typ)) { - RETVAL_LONG(MBSTRG(func_overload)); - } else if (!strcasecmp("func_overload_list", typ)) { - if (MBSTRG(func_overload)){ - over_func = &(mb_ovld[0]); - array_init(return_value); - while (over_func->type > 0) { - if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) { - add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func); - } - over_func++; - } - } else { - RETVAL_STRING("no overload"); - } } else if (!strcasecmp("mail_charset", typ)) { if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) { RETVAL_STRING(name); diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 5a713e5496..58ae9cebbc 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -153,7 +153,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) int filter_illegal_substchar; int current_filter_illegal_mode; int current_filter_illegal_substchar; - zend_long func_overload; enum mbfl_no_language language; zend_bool encoding_translation; zend_bool strict_detection; @@ -172,17 +171,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring) zend_bool http_input_set; ZEND_END_MODULE_GLOBALS(mbstring) -#define MB_OVERLOAD_MAIL 1 -#define MB_OVERLOAD_STRING 2 -#define MB_OVERLOAD_REGEX 4 - -struct mb_overload_def { - int type; - char *orig_func; - char *ovld_func; - char *save_func; -}; - #define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v) #if defined(ZTS) && defined(COMPILE_DL_MBSTRING) diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 9fac8233ba..4206a0a9f8 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -885,16 +885,16 @@ static int _php_mb_onig_search(regex_t* reg, const OnigUChar* str, const OnigUCh /* {{{ _php_mb_regex_ereg_exec */ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) { - zval *arg_pattern, *array = NULL; - char *string; - size_t string_len; + zval *array = NULL; + char *arg_pattern, *string; + size_t arg_pattern_len, string_len; php_mb_regex_t *re; OnigRegion *regs = NULL; int i, match_len, beg, end; OnigOptionType options; char *str; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|z", &arg_pattern, &string, &string_len, &array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &arg_pattern, &arg_pattern_len, &string, &string_len, &array) == FAILURE) { RETURN_FALSE; } @@ -918,25 +918,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) options |= ONIG_OPTION_IGNORECASE; } - /* compile the regular expression from the supplied regex */ - if (Z_TYPE_P(arg_pattern) != IS_STRING) { - /* we convert numbers to integers and treat them as a string */ - if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) { - convert_to_long_ex(arg_pattern); /* get rid of decimal places */ - } - if (!try_convert_to_string(arg_pattern)) { - return; - } - /* don't bother doing an extended regex with just a number */ - } - - if (Z_STRLEN_P(arg_pattern) == 0) { + if (arg_pattern_len == 0) { php_error_docref(NULL, E_WARNING, "empty pattern"); RETVAL_FALSE; goto out; } - re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax)); + re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), MBREX(regex_default_syntax)); if (re == NULL) { RETVAL_FALSE; goto out; @@ -1001,8 +989,6 @@ PHP_FUNCTION(mb_eregi) /* {{{ _php_mb_regex_ereg_replace_exec */ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOptionType options, int is_callable) { - zval *arg_pattern_zval; - char *arg_pattern; size_t arg_pattern_len; @@ -1025,7 +1011,6 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp OnigUChar *pos; OnigUChar *string_lim; char *description = NULL; - char pat_buf[6]; const mbfl_encoding *enc; @@ -1044,16 +1029,16 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp size_t option_str_len = 0; if (!is_callable) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zss|s", - &arg_pattern_zval, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|s", + &arg_pattern, &arg_pattern_len, &replace, &replace_len, &string, &string_len, &option_str, &option_str_len) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "zfs|s", - &arg_pattern_zval, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sfs|s", + &arg_pattern, &arg_pattern_len, &arg_replace_fci, &arg_replace_fci_cache, &string, &string_len, &option_str, &option_str_len) == FAILURE) { @@ -1077,28 +1062,10 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp } } if (eval && !is_callable) { - php_error_docref(NULL, E_DEPRECATED, "The 'e' option is deprecated, use mb_ereg_replace_callback instead"); - } - if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) { - arg_pattern = Z_STRVAL_P(arg_pattern_zval); - arg_pattern_len = Z_STRLEN_P(arg_pattern_zval); - } else { - php_error_docref(NULL, E_DEPRECATED, - "Non-string patterns will be interpreted as strings in the future. " - "Use an explicit chr() call to preserve the current behavior"); - - /* FIXME: this code is not multibyte aware! */ - convert_to_long_ex(arg_pattern_zval); - pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval); - pat_buf[1] = '\0'; - pat_buf[2] = '\0'; - pat_buf[3] = '\0'; - pat_buf[4] = '\0'; - pat_buf[5] = '\0'; - - arg_pattern = pat_buf; - arg_pattern_len = 1; + php_error_docref(NULL, E_WARNING, "The 'e' option is no longer supported, use mb_ereg_replace_callback instead"); + RETURN_FALSE; } + /* create regex pattern buffer */ re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), syntax); if (re == NULL) { diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h index 497458e603..e1ddeedae8 100644 --- a/ext/mbstring/php_mbregex.h +++ b/ext/mbstring/php_mbregex.h @@ -41,21 +41,7 @@ PHP_FE(mb_ereg_search_init, arginfo_mb_ereg_search_init) \ PHP_FE(mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \ PHP_FE(mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \ - PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) \ - PHP_DEP_FALIAS(mbregex_encoding, mb_regex_encoding, arginfo_mb_regex_encoding) \ - PHP_DEP_FALIAS(mbereg, mb_ereg, arginfo_mb_ereg) \ - PHP_DEP_FALIAS(mberegi, mb_eregi, arginfo_mb_eregi) \ - PHP_DEP_FALIAS(mbereg_replace, mb_ereg_replace, arginfo_mb_ereg_replace) \ - PHP_DEP_FALIAS(mberegi_replace, mb_eregi_replace, arginfo_mb_eregi_replace) \ - PHP_DEP_FALIAS(mbsplit, mb_split, arginfo_mb_split) \ - PHP_DEP_FALIAS(mbereg_match, mb_ereg_match, arginfo_mb_ereg_match) \ - PHP_DEP_FALIAS(mbereg_search, mb_ereg_search, arginfo_mb_ereg_search) \ - PHP_DEP_FALIAS(mbereg_search_pos, mb_ereg_search_pos, arginfo_mb_ereg_search_pos) \ - PHP_DEP_FALIAS(mbereg_search_regs, mb_ereg_search_regs, arginfo_mb_ereg_search_regs) \ - PHP_DEP_FALIAS(mbereg_search_init, mb_ereg_search_init, arginfo_mb_ereg_search_init) \ - PHP_DEP_FALIAS(mbereg_search_getregs, mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \ - PHP_DEP_FALIAS(mbereg_search_getpos, mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \ - PHP_DEP_FALIAS(mbereg_search_setpos, mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) + PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) /* }}} */ #define PHP_MBREGEX_MAXCACHE 50 diff --git a/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt deleted file mode 100644 index 1f62f08fd8..0000000000 --- a/ext/mbstring/tests/bug20087.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Bug #20087 (Assertion failure) ---SKIPIF-- -<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---FILE-- -<?php -$testmoo = "blah blah"; -var_dump(mb_parse_str("testmoo")); -var_dump($testmoo); -var_dump(mb_parse_str("test=moo")); -var_dump($test); -?> ---EXPECTF-- -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -bool(true) -string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -bool(true) -string(3) "moo" diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt deleted file mode 100644 index 6da3dd6bbe..0000000000 --- a/ext/mbstring/tests/bug43301.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #43301 (mb_ereg*_replace() crashes when replacement string is invalid PHP expression and 'e' option is used) ---SKIPIF-- -<?php -extension_loaded('mbstring') or die('skip mbstring not available'); -if (!function_exists('mb_ereg')) die('skip mbregex support not available'); -?> ---FILE-- -<?php - -$ptr = 'hello'; - -$txt = <<<doc -hello, I have got a cr*sh on you -doc; - -echo mb_ereg_replace($ptr,'$1',$txt,'e'); - -?> ---EXPECTF-- -Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug43301.php on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in %sbug43301.php(%d) : mbregex replace:1 -Stack trace: -#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e') -#1 {main} - -Next Error: Failed evaluating code: -$1 in %sbug43301.php:%d -Stack trace: -#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e') -#1 {main} - thrown in %sbug43301.php on line %d diff --git a/ext/mbstring/tests/bug48697.phpt b/ext/mbstring/tests/bug48697.phpt index 93644a5f05..77d1c7a710 100644 --- a/ext/mbstring/tests/bug48697.phpt +++ b/ext/mbstring/tests/bug48697.phpt @@ -2,8 +2,6 @@ Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str() --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---INI-- -error_reporting=E_ALL & ~E_DEPRECATED --FILE-- <?php ini_set('mbstring.internal_encoding', 'ISO-8859-15'); @@ -11,14 +9,15 @@ ini_set('mbstring.encoding_translation', true); var_dump(mb_internal_encoding()); mb_internal_encoding('UTF-8'); var_dump(mb_internal_encoding()); -parse_str('a=b'); +parse_str('a=b', $ary); var_dump(mb_internal_encoding()); mb_internal_encoding('UTF-8'); var_dump(mb_internal_encoding()); -parse_str('a=b'); +parse_str('a=b', $ary); var_dump(mb_internal_encoding()); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: ini_set(): Use of mbstring.internal_encoding is deprecated in %s on line %d string(11) "ISO-8859-15" string(5) "UTF-8" string(5) "UTF-8" diff --git a/ext/mbstring/tests/bug52931.phpt b/ext/mbstring/tests/bug52931.phpt deleted file mode 100644 index e7d7b6dda4..0000000000 --- a/ext/mbstring/tests/bug52931.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #52931 (strripos not overloaded with function overloading enabled) ---SKIPIF-- -<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---INI-- -mbstring.func_overload = 7 ---FILE-- -<?php - -$string = '<body>Umlauttest öüä</body>'; - -var_dump(strlen($string)); -var_dump(mb_strlen($string)); - -var_dump(strripos($string, '</body>')); -var_dump(mb_strripos($string, '</body>')); - -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -int(27) -int(27) -int(20) -int(20) diff --git a/ext/mbstring/tests/bug72164.phpt b/ext/mbstring/tests/bug72164.phpt index 018754e335..f90fe89938 100644 --- a/ext/mbstring/tests/bug72164.phpt +++ b/ext/mbstring/tests/bug72164.phpt @@ -14,5 +14,5 @@ $var8 = mb_ereg_replace($var2,$var3,$var3,$var0); var_dump($var8); ?> --EXPECTF-- -Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug72164.php on line %d -string(0) "" +Warning: mb_ereg_replace(): The 'e' option is no longer supported, use mb_ereg_replace_callback instead in %s on line %d +bool(false) diff --git a/ext/mbstring/tests/bug72994.phpt b/ext/mbstring/tests/bug72994.phpt deleted file mode 100644 index c9d2c9acf2..0000000000 --- a/ext/mbstring/tests/bug72994.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #72994 (mbc_to_code() out of bounds read) ---SKIPIF-- -<?php -if (!extension_loaded('mbstring')) die('skip mbstring extension not available'); -if (!function_exists('mb_ereg_replace')) die('skip mb_ereg_replace() not available'); -?> ---FILE-- -<?php -$var1 = mb_ereg_replace($var-232338951,NULL,NULL,NULL); -var_dump($var1); -?> -===DONE=== ---EXPECTF-- -Notice: Undefined variable: var in %s on line %d - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d -bool(false) -===DONE=== diff --git a/ext/mbstring/tests/mb_convert_encoding.phpt b/ext/mbstring/tests/mb_convert_encoding.phpt index f2fda35124..ac5d0d32a6 100644 --- a/ext/mbstring/tests/mb_convert_encoding.phpt +++ b/ext/mbstring/tests/mb_convert_encoding.phpt @@ -99,11 +99,6 @@ $s = $euc_jp; $s = mb_convert_encoding($s, 'BAD'); print("BAD: $s\n"); // BAD -$s = $euc_jp; -$s = mb_convert_encoding($s); -print("MP: $s\n"); // Missing parameter - - ?> --EXPECTF-- == BASIC TEST == @@ -129,6 +124,3 @@ EUC-JP: Warning: mb_convert_encoding(): Unknown encoding "BAD" in %s on line %d BAD: - -Warning: mb_convert_encoding() expects at least 2 parameters, 1 given in %s on line %d -MP: diff --git a/ext/mbstring/tests/mb_detect_encoding.phpt b/ext/mbstring/tests/mb_detect_encoding.phpt index 0c8015d86d..9a8f51281b 100644 --- a/ext/mbstring/tests/mb_detect_encoding.phpt +++ b/ext/mbstring/tests/mb_detect_encoding.phpt @@ -87,11 +87,6 @@ $s = $euc_jp; $s = mb_detect_encoding($s, 'BAD'); print("BAD: $s\n"); // BAD -$s = $euc_jp; -$s = mb_detect_encoding(); -print("MP: $s\n"); // Missing parameter - - ?> --EXPECTF-- == BASIC TEST == @@ -113,6 +108,3 @@ EUC-JP: EUC-JP Warning: mb_detect_encoding(): Illegal argument in %s on line %d BAD: EUC-JP - -Warning: mb_detect_encoding() expects at least 1 parameter, 0 given in %s on line %d -MP: diff --git a/ext/mbstring/tests/mb_encoding_aliases.phpt b/ext/mbstring/tests/mb_encoding_aliases.phpt index 8bc0453350..798bdeb5ca 100644 --- a/ext/mbstring/tests/mb_encoding_aliases.phpt +++ b/ext/mbstring/tests/mb_encoding_aliases.phpt @@ -4,7 +4,6 @@ mb_encoding_aliases() <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --FILE-- <?php -mb_encoding_aliases(); $list = mb_encoding_aliases("ASCII"); sort($list); var_dump($list); @@ -13,7 +12,6 @@ var_dump(mb_encoding_aliases("8bit")); var_dump(mb_encoding_aliases("BAD")); ?> --EXPECTF-- -Warning: mb_encoding_aliases() expects exactly 1 parameter, 0 given in %s on line 2 array(11) { [0]=> string(14) "ANSI_X3.4-1968" diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt index 59ef788a77..05b3486545 100644 --- a/ext/mbstring/tests/mb_ereg1.phpt +++ b/ext/mbstring/tests/mb_ereg1.phpt @@ -14,7 +14,11 @@ $a = array( ); foreach ($a as $args) { - var_dump(mb_ereg($args[0], $args[1], $args[2])); + try { + var_dump(mb_ereg($args[0], $args[1], $args[2])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump($args); } ?> @@ -42,9 +46,7 @@ array(3) { array(0) { } } - -Notice: Array to string conversion in %s on line %d -bool(false) +mb_ereg() expects parameter 1 to be string, array given array(3) { [0]=> array(0) { @@ -52,12 +54,9 @@ array(3) { [1]=> int(1) [2]=> - array(0) { - } + &string(0) "" } - -Warning: mb_ereg() expects parameter 2 to be string, array given in %s on line %d -bool(false) +mb_ereg() expects parameter 2 to be string, array given array(3) { [0]=> int(1) @@ -65,7 +64,7 @@ array(3) { array(0) { } [2]=> - string(0) "" + &string(0) "" } bool(false) array(3) { diff --git a/ext/mbstring/tests/mb_ereg2.phpt b/ext/mbstring/tests/mb_ereg2.phpt index 30e857eed7..22e3cd36c5 100644 --- a/ext/mbstring/tests/mb_ereg2.phpt +++ b/ext/mbstring/tests/mb_ereg2.phpt @@ -15,12 +15,9 @@ var_dump($a, $b, $c); mb_eregi($a, $b, $c); var_dump($a, $b, $c); -mb_ereg_search_init($a, $b, $c); -var_dump($a, $b, $c); - echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(-1) int(-1) array(1) { @@ -33,12 +30,4 @@ array(1) { [0]=> string(2) "-1" } - -Warning: mb_ereg_search_init() expects parameter 3 to be string, array given in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} Done diff --git a/ext/mbstring/tests/mb_ereg3.phpt b/ext/mbstring/tests/mb_ereg3.phpt deleted file mode 100644 index c591563444..0000000000 --- a/ext/mbstring/tests/mb_ereg3.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -mb_ereg() returning matches ---SKIPIF-- -<?php -if (!extension_loaded('mbstring')) die('skip mbstring not enabled'); -if (!function_exists("mb_ereg")) print "skip mb_ereg() not available"; -?> ---FILE-- -<?php - -// Note: This test is identical to mb_ereg2.phpt, but using deprecated mbereg_* aliases. -// Deleted it once the deprecated aliases have been removed. - -$a = -1; $b = -1; $c = -1; -mbereg($a, $b, $c); -var_dump($a, $b, $c); - -mberegi($a, $b, $c); -var_dump($a, $b, $c); - -mbereg_search_init($a, $b, $c); -var_dump($a, $b, $c); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function mbereg() is deprecated in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} - -Deprecated: Function mberegi() is deprecated in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} - -Deprecated: Function mbereg_search_init() is deprecated in %s on line %d - -Warning: mbereg_search_init() expects parameter 3 to be string, array given in %s on line %d -int(-1) -int(-1) -array(1) { - [0]=> - string(2) "-1" -} -Done diff --git a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt index 4c6e177b3e..c61e47723d 100644 --- a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt +++ b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt @@ -96,87 +96,53 @@ foreach($inputs as $input) { echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing mb_ereg_replace() : usage variations *** -- Iteration 1 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 2 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 3 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 4 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d -bool(false) +string(10) "string_val" -- Iteration 5 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 6 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d -bool(false) +string(10) "string_val" -- Iteration 7 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 8 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 9 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 10 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 11 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 12 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 13 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 14 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 15 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 16 -- string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" @@ -194,17 +160,11 @@ string(10) "string_val" string(10) "string_val" -- Iteration 21 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d string(10) "string_val" -- Iteration 22 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" -- Iteration 23 -- - -Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(10) "string_val" +string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val" Done diff --git a/ext/mbstring/tests/mb_ereg_variation1.phpt b/ext/mbstring/tests/mb_ereg_variation1.phpt deleted file mode 100644 index 60baf8743e..0000000000 --- a/ext/mbstring/tests/mb_ereg_variation1.phpt +++ /dev/null @@ -1,178 +0,0 @@ ---TEST-- -Test mb_ereg() function : usage variations - pass different data types to $pattern argument ---SKIPIF-- -<?php -extension_loaded('mbstring') or die('skip'); -function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build"); -?> ---FILE-- -<?php -/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers]) - * Description: Regular expression match for multibyte string - * Source code: ext/mbstring/php_mbregex.c - */ - -/* - * Pass different data types to $pattern argument - */ - -echo "*** Testing mb_ereg() : usage variations ***\n"; - -// Initialise function arguments not being substituted (if any) -$string = 'string value'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $pattern argument -$inputs = array( - -// int data -/*1*/ 0, - 1, - 12345, - -2345, - -// float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - -// boolean data -/*10*/ true, - TRUE, - -// string data -/*12*/ "string", - 'string', - $heredoc, - -// object data -/*15*/ new classA(), - -// resource variable -/*16*/ $fp -); - -// loop through each element of $inputs to check the behavior of mb_ereg() -$iterator = 1; -foreach($inputs as $input) { - if (@is_array($regs)){ - $regs = null; - } - echo "\n-- Iteration $iterator --\n"; - var_dump( mb_ereg($input, $string, $regs) ); - var_dump($regs); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECT-- -*** Testing mb_ereg() : usage variations *** - --- Iteration 1 -- -bool(false) -array(0) { -} - --- Iteration 2 -- -bool(false) -array(0) { -} - --- Iteration 3 -- -bool(false) -array(0) { -} - --- Iteration 4 -- -bool(false) -array(0) { -} - --- Iteration 5 -- -bool(false) -array(0) { -} - --- Iteration 6 -- -bool(false) -array(0) { -} - --- Iteration 7 -- -bool(false) -array(0) { -} - --- Iteration 8 -- -bool(false) -array(0) { -} - --- Iteration 9 -- -bool(false) -array(0) { -} - --- Iteration 10 -- -bool(false) -array(0) { -} - --- Iteration 11 -- -bool(false) -array(0) { -} - --- Iteration 12 -- -int(6) -array(1) { - [0]=> - string(6) "string" -} - --- Iteration 13 -- -int(6) -array(1) { - [0]=> - string(6) "string" -} - --- Iteration 14 -- -bool(false) -array(0) { -} - --- Iteration 15 -- -bool(false) -array(0) { -} - --- Iteration 16 -- -bool(false) -array(0) { -} -Done diff --git a/ext/mbstring/tests/mb_get_info.phpt b/ext/mbstring/tests/mb_get_info.phpt index 5b9c0c0aef..4b08b9943f 100644 --- a/ext/mbstring/tests/mb_get_info.phpt +++ b/ext/mbstring/tests/mb_get_info.phpt @@ -9,7 +9,6 @@ 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 @@ -24,8 +23,7 @@ foreach (array_keys($result) as $key) { } ?> --EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -array(15) { +array(13) { ["internal_encoding"]=> string(5) "UTF-8" ["http_input"]=> @@ -34,35 +32,6 @@ array(15) { 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"]=> @@ -99,60 +68,6 @@ 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" diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt index b62734f02d..60581576b6 100644 --- a/ext/mbstring/tests/mb_http_output.phpt +++ b/ext/mbstring/tests/mb_http_output.phpt @@ -47,16 +47,6 @@ $r = mb_http_output('BAD_NAME'); $enc = mb_http_output(); print "$enc\n"; -$r = mb_http_output($t_ary); -($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n"; -$enc = mb_http_output(); -print "$enc\n"; - -$r = mb_http_output($t_obj); -($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n"; -$enc = mb_http_output(); -print "$enc\n"; - ?> --EXPECTF-- OK_ASCII_SET @@ -74,11 +64,3 @@ EUC-JP Warning: mb_http_output(): Unknown encoding "BAD_NAME" in %s on line %d OK_BAD_SET EUC-JP - -Warning: mb_http_output() expects parameter 1 to be string, array given in %s on line %d -OK_BAD_ARY_SET -EUC-JP - -Warning: mb_http_output() expects parameter 1 to be string, object given in %s on line %d -OK_BAD_OBJ_SET -EUC-JP diff --git a/ext/mbstring/tests/mb_internal_encoding.phpt b/ext/mbstring/tests/mb_internal_encoding.phpt index 50b696e1bd..9a0191237d 100644 --- a/ext/mbstring/tests/mb_internal_encoding.phpt +++ b/ext/mbstring/tests/mb_internal_encoding.phpt @@ -35,16 +35,6 @@ $r = mb_internal_encoding('BAD'); $enc = mb_internal_encoding(); print "$enc\n"; -$r = mb_internal_encoding($t_ary); -($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n"; -$enc = mb_internal_encoding(); -print "$enc\n"; - -$r = mb_internal_encoding($t_obj); -($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n"; -$enc = mb_internal_encoding(); -print "$enc\n"; - ?> --EXPECTF-- OK_EUC-JP_SET @@ -58,11 +48,3 @@ ASCII Warning: mb_internal_encoding(): Unknown encoding "BAD" in %s on line %d OK_BAD_SET ASCII - -Warning: mb_internal_encoding() expects parameter 1 to be string, array given in %s on line %d -OK_BAD_ARY_SET -ASCII - -Warning: mb_internal_encoding() expects parameter 1 to be string, object given in %s on line %d -OK_BAD_OBJ_SET -ASCII diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt index 8580ac52c5..ab504f918f 100644 --- a/ext/mbstring/tests/mb_parse_str.phpt +++ b/ext/mbstring/tests/mb_parse_str.phpt @@ -18,9 +18,6 @@ function test($query) { var_dump($array); var_dump($foo); var_dump($bar); - mb_parse_str($query); - var_dump($foo); - var_dump($bar); } foreach ($queries as $query) { test($query); @@ -35,10 +32,6 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(3) "abc" -string(3) "def" array(2) { ["+foo"]=> string(3) "def" @@ -47,10 +40,6 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(0) "" -string(0) "" array(2) { ["foo"]=> array(3) { @@ -69,17 +58,3 @@ array(2) { } string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -array(3) { - [0]=> - string(3) "abc" - [1]=> - string(3) "def" - [2]=> - string(3) "ghi" -} -array(1) { - [0]=> - string(3) "jkl" -} diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt index e1871bf596..bad388ee90 100644 --- a/ext/mbstring/tests/mb_parse_str02.phpt +++ b/ext/mbstring/tests/mb_parse_str02.phpt @@ -20,10 +20,6 @@ function test($query) { var_dump($foo); var_dump($bar); var_dump($fubar); - mb_parse_str($query); - var_dump($foo); - var_dump($bar); - var_dump($fubar); } foreach ($queries as $query) { test($query); @@ -41,11 +37,6 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(3) "abc" -string(3) "def" -string(3) "ghi" array(3) { ["+foo"]=> string(3) "def" @@ -57,11 +48,6 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -string(0) "" -string(0) "" -string(0) "" array(3) { ["foo"]=> array(4) { @@ -88,23 +74,3 @@ array(3) { string(0) "" string(0) "" string(0) "" - -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d -array(4) { - [0]=> - string(3) "abc" - [1]=> - string(3) "def" - [2]=> - string(3) "ghi" - [3]=> - string(0) "" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "=" -} diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt index d2476658da..9e9cd4080b 100644 --- a/ext/mbstring/tests/mb_split.phpt +++ b/ext/mbstring/tests/mb_split.phpt @@ -5,8 +5,6 @@ mb_split() extension_loaded('mbstring') or die('skip mbstring not available'); function_exists('mb_split') or die("skip mb_split() is not available in this build"); ?> ---INI-- -mbstring.func_overload=0 --FILE-- <?php mb_regex_set_options( '' ); diff --git a/ext/mbstring/tests/mb_stripos.phpt b/ext/mbstring/tests/mb_stripos.phpt index 9da6456992..067c3f2826 100644 --- a/ext/mbstring/tests/mb_stripos.phpt +++ b/ext/mbstring/tests/mb_stripos.phpt @@ -125,18 +125,6 @@ $r = mb_stripos($euc_jp, '´Ú¹ñ¸ì'); $r = mb_stripos($euc_jp, "\n"); ($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n"; - -// Invalid Parameters -echo "== INVALID PARAMETER TEST ==\n"; - -$r = mb_stripos($euc_jp,'','EUC-JP'); -($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n"); -$r = mb_stripos($euc_jp, $t_ary, 'EUC-JP'); -($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n"); -$r = mb_stripos($euc_jp, $t_obj, 'EUC-JP'); -($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n"); -$r = mb_stripos($euc_jp, $t_obj, 'BAD_ENCODING'); -($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n"); ?> ==DONE== --EXPECTF-- @@ -213,17 +201,4 @@ OK_NEWLINE 0 OK_STR OK_NEWLINE -== INVALID PARAMETER TEST == - -Warning: mb_stripos() expects parameter 3 to be int, string given in %s on line %d -OK_NULL - -Warning: mb_stripos() expects parameter 2 to be string, array given in %s on line %d -OK_ARRAY - -Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d -OK_OBJECT - -Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d -OK_BAD_ENCODING ==DONE== diff --git a/ext/mbstring/tests/mb_strlen.phpt b/ext/mbstring/tests/mb_strlen.phpt index ee71106937..fa546b2c59 100644 --- a/ext/mbstring/tests/mb_strlen.phpt +++ b/ext/mbstring/tests/mb_strlen.phpt @@ -2,8 +2,6 @@ mb_strlen() --SKIPIF-- <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---INI-- -mbstring.func_overload=0 --FILE-- <?php // TODO: Add more encodings @@ -55,14 +53,6 @@ print strlen($utf8) . "\n"; // Wrong Parameters echo "== WRONG PARAMETERS ==\n"; -// Array -// Note: PHP Warning, strlen() expects parameter 1 to be string, array given -$r = strlen($t_ary); -echo $r."\n"; -// Object -// Note: PHP Warning, strlen() expects parameter 1 to be string, object given -$r = strlen($t_obj); -echo $r."\n"; // Wrong encoding mb_internal_encoding('EUC-JP'); $r = mb_strlen($euc_jp, 'BAD_NAME'); @@ -88,10 +78,4 @@ echo $r."\n"; 101 == WRONG PARAMETERS == -Warning: strlen() expects parameter 1 to be string, array given in %s on line %d - - -Warning: strlen() expects parameter 1 to be string, object given in %s on line %d - - Warning: mb_strlen(): Unknown encoding "BAD_NAME" in %s on line %d diff --git a/ext/mbstring/tests/mb_strpos.phpt b/ext/mbstring/tests/mb_strpos.phpt index 9bca0ba390..c86b77e7de 100644 --- a/ext/mbstring/tests/mb_strpos.phpt +++ b/ext/mbstring/tests/mb_strpos.phpt @@ -125,18 +125,6 @@ $r = mb_strpos($euc_jp, '´Ú¹ñ¸ì'); $r = mb_strpos($euc_jp, "\n"); ($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n"; - -// Invalid Parameters -echo "== INVALID PARAMETER TEST ==\n"; - -$r = mb_strpos($euc_jp,'','EUC-JP'); -($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n"); -$r = mb_strpos($euc_jp, $t_ary, 'EUC-JP'); -($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n"); -$r = mb_strpos($euc_jp, $t_obj, 'EUC-JP'); -($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n"); -$r = mb_strpos($euc_jp, $t_obj, 'BAD_ENCODING'); -($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n"); ?> ==DONE== --EXPECTF-- @@ -213,17 +201,4 @@ OK_NEWLINE 0 OK_STR OK_NEWLINE -== INVALID PARAMETER TEST == - -Warning: mb_strpos() expects parameter 3 to be int, string given in %s on line %d -OK_NULL - -Warning: mb_strpos() expects parameter 2 to be string, array given in %s on line %d -OK_ARRAY - -Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d -OK_OBJECT - -Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d -OK_BAD_ENCODING ==DONE== diff --git a/ext/mbstring/tests/mb_substitute_character_variation1.phpt b/ext/mbstring/tests/mb_substitute_character_variation1.phpt index f738876469..69912eca50 100644 --- a/ext/mbstring/tests/mb_substitute_character_variation1.phpt +++ b/ext/mbstring/tests/mb_substitute_character_variation1.phpt @@ -16,8 +16,8 @@ function_exists('mb_substitute_character') or die("skip mb_substitute_character( echo "*** Testing mb_substitute_character() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/mbstring/tests/mb_substr.phpt b/ext/mbstring/tests/mb_substr.phpt index 28b35ea910..ab4f7c17d6 100644 --- a/ext/mbstring/tests/mb_substr.phpt +++ b/ext/mbstring/tests/mb_substr.phpt @@ -4,7 +4,6 @@ mb_substr() <?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> --INI-- output_handler= -mbstring.func_overload=0 --FILE-- <?php // TODO: Add more encodings diff --git a/ext/mbstring/tests/overload01.phpt b/ext/mbstring/tests/overload01.phpt deleted file mode 100644 index 436608a89c..0000000000 --- a/ext/mbstring/tests/overload01.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Function overloading test 1 ---SKIPIF-- -<?php - extension_loaded('mbstring') or die('skip mbstring not available'); -?> ---INI-- -output_handler= -mbstring.func_overload=7 -internal_encoding=EUC-JP ---FILE-- -<?php -echo mb_internal_encoding()."\n"; - -$ngchars = array('ǽ','ɽ','»½','¥½'); -$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼'; -var_dump(strlen($str)); -var_dump(mb_strlen($str)); ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -EUC-JP -int(33) -int(33) diff --git a/ext/mbstring/tests/overload02.phpt b/ext/mbstring/tests/overload02.phpt deleted file mode 100644 index 2e4bbe856a..0000000000 --- a/ext/mbstring/tests/overload02.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Function overloading test 2 ---SKIPIF-- -<?php - extension_loaded('mbstring') or die('skip mbstring not available'); - if (!function_exists("mb_ereg_replace")) { - die('skip mb_ereg_replace() function is not available.'); - } -?> ---INI-- -output_handler= -mbstring.func_overload=7 -internal_encoding=EUC-JP ---FILE-- -<?php -echo mb_internal_encoding()."\n"; - -$ngchars = array('ǽ','ɽ','»½','¥½'); -$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼'; -$converted_str = mb_convert_encoding($str, 'Shift_JIS'); -mb_regex_encoding('Shift_JIS'); -foreach($ngchars as $c) { - $c = mb_convert_encoding($c, 'Shift_JIS'); - $replaced = mb_convert_encoding(str_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS'); - var_dump(strpos($replaced, '!!')); -} -?> ---EXPECT-- -Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0 -EUC-JP -int(10) -int(8) -int(3) -int(29) |