From 64a88deb04b615ef4127ff02ff3c7b87f9088a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 16 Nov 2019 20:57:36 +0100 Subject: [PATCH 1/7] Remove support for mixing parameter order in implode() --- Zend/tests/unexpected_ref_bug.phpt | 3 - ext/spl/tests/bug75717.phpt | 2 +- ext/standard/basic_functions.stub.php | 7 +- ext/standard/basic_functions_arginfo.h | 2 +- ext/standard/string.c | 16 ++-- ext/standard/tests/strings/implode1.phpt | Bin 6042 -> 5957 bytes .../tests/strings/join_variation1.phpt | 76 +++++++----------- .../tests/strings/join_variation2.phpt | 46 +++++------ .../tests/strings/join_variation4.phpt | Bin 2319 -> 2021 bytes .../tests/strings/join_variation5.phpt | 24 +++--- 10 files changed, 74 insertions(+), 102 deletions(-) diff --git a/Zend/tests/unexpected_ref_bug.phpt b/Zend/tests/unexpected_ref_bug.phpt index a4e74e7a670b6..df9313ab0ee9b 100644 --- a/Zend/tests/unexpected_ref_bug.phpt +++ b/Zend/tests/unexpected_ref_bug.phpt @@ -11,10 +11,7 @@ class Test { } $my_var = str_repeat("A",64); $data = call_user_func_array("explode",array(new Test(), &$my_var)); -$my_var=array(1,2,3); -$data = call_user_func_array("implode",array(&$my_var, new Test())); echo "Done.\n"; ?> --EXPECTF-- -Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d Done. diff --git a/ext/spl/tests/bug75717.phpt b/ext/spl/tests/bug75717.phpt index 485b9d8bc4a0f..ee7ae6f781bfa 100644 --- a/ext/spl/tests/bug75717.phpt +++ b/ext/spl/tests/bug75717.phpt @@ -8,7 +8,7 @@ function flatten(array $nestedArraysAndStrings){ $iter = new RecursiveIteratorIterator( new RecursiveArrayIterator($nestedArraysAndStrings)); foreach($iter as $leaf){ $flat[] = $leaf; } - return join(NULL, $flat); + return join("", $flat); } $noRefs = [[[['some']]],[' nested '],"items"]; diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index ba7e17d7bc254..3e687547d7eb7 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -543,11 +543,8 @@ function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut function explode(string $separator, string $str, int $limit = PHP_INT_MAX): array {} -/** - * @param string $glue Optional - defaults to empty string - * @param array $pieces - */ -function implode($glue, $pieces = UNKNOWN): string {} +/** @param string|array $glue */ +function implode($glue, array $pieces = UNKNOWN): string {} /** * @param string $str Optional - defaults to previous string diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 82d15731cbba2..7ed3f8017a6ab 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -852,7 +852,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_implode, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, glue) - ZEND_ARG_INFO(0, pieces) + ZEND_ARG_TYPE_INFO(0, pieces, IS_ARRAY, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtok, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) diff --git a/ext/standard/string.c b/ext/standard/string.c index a23c85c6d3632..b947933fc1fc2 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1264,16 +1264,16 @@ PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_valu Joins array elements placing glue string between items and return one string */ PHP_FUNCTION(implode) { - zval *arg1, *arg2 = NULL, *pieces; + zval *arg1, *pieces = NULL; zend_string *glue, *tmp_glue; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(arg1) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(arg2) + Z_PARAM_ARRAY(pieces) ZEND_PARSE_PARAMETERS_END(); - if (arg2 == NULL) { + if (pieces == NULL) { if (Z_TYPE_P(arg1) != IS_ARRAY) { zend_type_error("Argument must be an array"); return; @@ -1283,16 +1283,10 @@ PHP_FUNCTION(implode) tmp_glue = NULL; pieces = arg1; } else { - if (Z_TYPE_P(arg1) == IS_ARRAY) { - glue = zval_get_tmp_string(arg2, &tmp_glue); - pieces = arg1; - php_error_docref(NULL, E_DEPRECATED, - "Passing glue string after array is deprecated. Swap the parameters"); - } else if (Z_TYPE_P(arg2) == IS_ARRAY) { + if (Z_TYPE_P(arg1) == IS_STRING) { glue = zval_get_tmp_string(arg1, &tmp_glue); - pieces = arg2; } else { - zend_type_error("Invalid arguments passed"); + zend_type_error("The first argument must be string"); return; } } diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt index 500bdc6dce5b026a3e7841c8fb68c096a9f48c05..ad0d5fbab1453435858ffee68795596230254f0a 100644 GIT binary patch delta 821 zcmbQGe^hUS8zWOu;${!VCT7l(qDqBoE(HaJ$^NWjlkc#IPFCO%wXR4`Ehx#%&(nm+ z0i{!uGx8NwQehIhcIl}lzNy8O$8+-m=Srz RSPaofy4@)HT=Mf$xd0q%6m9?j delta 564 zcmX@AH%otm8zWO<(Pj_ECg#bTS%oIQWD(sQ$Xd%d`8u1)JYSG?GLMiM zi;04+?&Je}=22WOsRc!;$%!SYDOL)Zxdl1-DXAKoRtf=$#l=A56w-4_Q=vvHB&L<5 z7AYha6(v?GWELx=z;)^=1eYfkD3oNRDikCZCFZ6A)fG?PC?Y9rXbf~sc50=eBS;sJ zVWhPAr=Slb$PucRKu2()INQL$0OV`~Lj$0*fgA$`1CX;fuMl=&oP3bajKxX9nOByWlbHexqx90; i)Vz{nV0aW4r>1b>lz@8Q0BEWbZdEw7yX5DkasdF^2Dr)q diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt index 33c519f13ef01..a7ab4750054e6 100644 --- a/ext/standard/tests/strings/join_variation1.phpt +++ b/ext/standard/tests/strings/join_variation1.phpt @@ -91,9 +91,13 @@ for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $glue = $values [$index]; - var_dump( join($glue, $pieces) ); + try { + var_dump(join($glue, $pieces)); + } catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; + } - $counter ++; + $counter++; } echo "Done\n"; @@ -103,75 +107,55 @@ echo "Done\n"; --- Testing join() by supplying different values for 'glue' argument --- -- Iteration 1 -- -string(17) "element10element2" +The first argument must be string -- Iteration 2 -- -string(17) "element11element2" +The first argument must be string -- Iteration 3 -- -string(21) "element112345element2" +The first argument must be string -- Iteration 4 -- -string(21) "element1-2345element2" +The first argument must be string -- Iteration 5 -- -string(20) "element110.5element2" +The first argument must be string -- Iteration 6 -- -string(21) "element1-10.5element2" +The first argument must be string -- Iteration 7 -- -string(28) "element1101234567000element2" +The first argument must be string -- Iteration 8 -- -string(29) "element11.07654321E-9element2" +The first argument must be string -- Iteration 9 -- -string(19) "element10.5element2" +The first argument must be string -- Iteration 10 -- - -Warning: Array to string conversion in %s on line %d - -Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d -string(0) "" +The first argument must be string -- Iteration 11 -- - -Warning: Array to string conversion in %s on line %d - -Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d -string(1) "0" +The first argument must be string -- Iteration 12 -- - -Warning: Array to string conversion in %s on line %d - -Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d -string(1) "1" +The first argument must be string -- Iteration 13 -- - -Warning: Array to string conversion in %s on line %d - -Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d -string(7) "1Array2" +The first argument must be string -- Iteration 14 -- - -Warning: Array to string conversion in %s on line %d - -Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d -string(11) "redArraypen" +The first argument must be string -- Iteration 15 -- -string(17) "element11element2" +The first argument must be string -- Iteration 16 -- -string(16) "element1element2" +The first argument must be string -- Iteration 17 -- -string(17) "element11element2" +The first argument must be string -- Iteration 18 -- -string(16) "element1element2" +The first argument must be string -- Iteration 19 -- -string(26) "element1testObjectelement2" +The first argument must be string -- Iteration 20 -- string(16) "element1element2" -- Iteration 21 -- string(16) "element1element2" -- Iteration 22 -- -string(16) "element1element2" +The first argument must be string -- Iteration 23 -- -string(16) "element1element2" +The first argument must be string -- Iteration 24 -- -string(%d) "element1Resource id #%delement2" +The first argument must be string -- Iteration 25 -- -string(16) "element1element2" +The first argument must be string -- Iteration 26 -- -string(16) "element1element2" +The first argument must be string Done diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt index 16e053cce10ac..72b5217d0c2bc 100644 --- a/ext/standard/tests/strings/join_variation2.phpt +++ b/ext/standard/tests/strings/join_variation2.phpt @@ -108,49 +108,49 @@ echo "Done\n"; --- Testing join() by supplying different values for 'pieces' argument --- -- Iteration 1 -- -Invalid arguments passed +join() expects parameter 2 to be array, int given -- Iteration 2 -- -Invalid arguments passed +join() expects parameter 2 to be array, int given -- Iteration 3 -- -Invalid arguments passed +join() expects parameter 2 to be array, int given -- Iteration 4 -- -Invalid arguments passed +join() expects parameter 2 to be array, int given -- Iteration 5 -- -Invalid arguments passed +join() expects parameter 2 to be array, float given -- Iteration 6 -- -Invalid arguments passed +join() expects parameter 2 to be array, float given -- Iteration 7 -- -Invalid arguments passed +join() expects parameter 2 to be array, float given -- Iteration 8 -- -Invalid arguments passed +join() expects parameter 2 to be array, float given -- Iteration 9 -- -Invalid arguments passed +join() expects parameter 2 to be array, float given -- Iteration 10 -- -Invalid arguments passed +join() expects parameter 2 to be array, bool given -- Iteration 11 -- -Invalid arguments passed +join() expects parameter 2 to be array, bool given -- Iteration 12 -- -Invalid arguments passed +join() expects parameter 2 to be array, bool given -- Iteration 13 -- -Invalid arguments passed +join() expects parameter 2 to be array, bool given -- Iteration 14 -- -Invalid arguments passed +join() expects parameter 2 to be array, string given -- Iteration 15 -- -Invalid arguments passed +join() expects parameter 2 to be array, string given -- Iteration 16 -- -Invalid arguments passed +join() expects parameter 2 to be array, object given -- Iteration 17 -- -Invalid arguments passed +join() expects parameter 2 to be array, string given -- Iteration 18 -- -Invalid arguments passed +join() expects parameter 2 to be array, string given -- Iteration 19 -- -Invalid arguments passed +join() expects parameter 2 to be array, null given -- Iteration 20 -- -Invalid arguments passed +join() expects parameter 2 to be array, null given -- Iteration 21 -- -Invalid arguments passed +join() expects parameter 2 to be array, resource given -- Iteration 22 -- -Invalid arguments passed +join() expects parameter 2 to be array, null given -- Iteration 23 -- -Invalid arguments passed +join() expects parameter 2 to be array, null given Done diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt index 49cbfa15bce3320029de5f331e0082cf23e674d6..e5afdf1bb682f3220295aa8a13c17b36b536bf8b 100644 GIT binary patch delta 407 zcmeAdddj~cj9Iv(s8XStO92SV5{u$fN^=V|CMPh<25VXa1#1vTR8lLFQwvHm^Yb*J`cjiK@{xpf?b1_Ad{c{y6Vp>QG!^s|lw$Ifz=ln3V18a7 zl98&AmRVF>qL5gWUYeVlSE7(x3gjiFDioI#W#*-G>FO$YmZTOXg6vQ*R?yYuB2kYC l9z9$Li#DHRUB*bNdo1yojW8P34~7P~HE|>PeDY$B900$yiKhSn delta 501 zcmZWmze@u#6sDYqaEsvPAU+C(-f$(ay&hf_L~u|CDG2HyO6bKJZF5I*t#s<>=#c-x zS@5rMbdZkz3nq70r5H%^e&u^#zW259viWx5cvC8GlgT)1g67V)1OA@=a2AouB^SeH zch`q{8wmzcC&mC-o(kXs8VZat;(|dV@w_9JNj9K4OM38-a?$jA(5FfnBp8k+Yzac| zawdTm&|E?C`>X{A=T9_){GLHZB^@(UsQ!1V{)rv)&qp@Hf~7Iq_4gC^wKiYo+o2W0 z2+)n9h*Y-~WoeeuRGwAJ78;rU@;0#QLFKN9SjEc5df{%>VtwVF?IW>zR(#625JD^k XOUKTIATbS1kN{bMB*k2w*Kd9RF5QkA diff --git a/ext/standard/tests/strings/join_variation5.phpt b/ext/standard/tests/strings/join_variation5.phpt index f81524543dacc..d5ff8ca0aa6a5 100644 --- a/ext/standard/tests/strings/join_variation5.phpt +++ b/ext/standard/tests/strings/join_variation5.phpt @@ -19,10 +19,18 @@ $sub_array = array(array(1,2,3,4), array(1 => "one", 2 => "two"), "PHP", 50); var_dump( join("TEST", $sub_array) ); // glue as array & pieces as array containing sub array -var_dump( join(array(1, 2, 3, 4), $sub_array) ); +try { + var_dump( join(array(1, 2, 3, 4), $sub_array) ); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} // numeric value as glue, pieces as array containg sub array -var_dump( join(2, $sub_array) ); +try { + var_dump( join(2, $sub_array) ); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} // using directly the sub_array as pieces var_dump( join(", ", $sub_array[0]) ); @@ -37,16 +45,8 @@ Warning: Array to string conversion in %s on line %d Warning: Array to string conversion in %s on line %d string(27) "ArrayTESTArrayTESTPHPTEST50" - -Warning: Array to string conversion in %s on line %d - -Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d -string(19) "1Array2Array3Array4" - -Warning: Array to string conversion in %s on line %d - -Warning: Array to string conversion in %s on line %d -string(18) "Array2Array2PHP250" +The first argument must be string +The first argument must be string string(10) "1, 2, 3, 4" string(8) "one, two" Done From 071e4e5ea2fe7fb213962d472d182c47bbf0002b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 17 Nov 2019 20:56:03 +0100 Subject: [PATCH 2/7] Remove hebrevc() function --- ext/opcache/Optimizer/zend_func_info.c | 1 - ext/standard/basic_functions.c | 1 - ext/standard/basic_functions.stub.php | 2 - ext/standard/basic_functions_arginfo.h | 2 - ext/standard/php_string.h | 1 - ext/standard/string.c | 32 ++---------- ext/standard/tests/strings/hebrevc_basic.phpt | 49 ------------------- 7 files changed, 4 insertions(+), 84 deletions(-) delete mode 100644 ext/standard/tests/strings/hebrevc_basic.phpt diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 7bec6593babde..d9cc9e1728a0d 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -164,7 +164,6 @@ static const func_info_t func_infos[] = { F0("strripos", MAY_BE_FALSE | MAY_BE_LONG), F1("strrev", MAY_BE_STRING), F1("hebrev", MAY_BE_STRING), - F1("hebrevc", MAY_BE_STRING), FN("nl2br", MAY_BE_STRING), F1("basename", MAY_BE_STRING), F1("dirname", MAY_BE_NULL | MAY_BE_STRING), diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a00b2a6f4e17f..49f4f68979508 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -914,7 +914,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(strripos, arginfo_strripos) PHP_FE(strrev, arginfo_strrev) PHP_FE(hebrev, arginfo_hebrev) - PHP_DEP_FE(hebrevc, arginfo_hebrevc) PHP_FE(nl2br, arginfo_nl2br) PHP_FE(basename, arginfo_basename) PHP_FE(dirname, arginfo_dirname) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 3e687547d7eb7..44f54a071da15 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -636,8 +636,6 @@ function str_ireplace($search, $replace, $subject, &$replace_count = UNKNOWN): s function hebrev(string $str, int $max_chars_per_line = 0): string {} -function hebrevc(string $str, int $max_chars_per_line = 0): string {} - function nl2br(string $str, bool $is_xhtml = true): string {} /** @param mixed $allowable_tags */ diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 7ed3f8017a6ab..071ffc1c111f6 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -981,8 +981,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hebrev, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, max_chars_per_line, IS_LONG, 0) ZEND_END_ARG_INFO() -#define arginfo_hebrevc arginfo_hebrev - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_nl2br, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, is_xhtml, _IS_BOOL, 0) diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 7e5f6566e4db9..bdeb87b9123a7 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -52,7 +52,6 @@ PHP_FUNCTION(ucwords); PHP_FUNCTION(strtr); PHP_FUNCTION(strrev); PHP_FUNCTION(hebrev); -PHP_FUNCTION(hebrevc); PHP_FUNCTION(user_sprintf); PHP_FUNCTION(user_printf); PHP_FUNCTION(vprintf); diff --git a/ext/standard/string.c b/ext/standard/string.c index b947933fc1fc2..ed8709d429511 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -4384,12 +4384,9 @@ PHP_FUNCTION(str_ireplace) } /* }}} */ -/* {{{ php_hebrev - * - * Converts Logical Hebrew text (Hebrew Windows style) to Visual text - * Cheers/complaints/flames - Zeev Suraski - */ -static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) +/* {{{ proto string hebrev(string str [, int max_chars_per_line]) + Converts logical Hebrew text to visual text */ +PHP_FUNCTION(hebrev) { char *str, *heb_str, *target; const char *tmp; @@ -4549,28 +4546,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) } efree(heb_str); - if (convert_newlines) { - RETVAL_STR(php_char_to_str_ex(broken_str, '\n', "
\n", 7, 1, NULL)); - zend_string_release_ex(broken_str, 0); - } else { - RETURN_NEW_STR(broken_str); - } -} -/* }}} */ - -/* {{{ proto string hebrev(string str [, int max_chars_per_line]) - Converts logical Hebrew text to visual text */ -PHP_FUNCTION(hebrev) -{ - php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto string hebrevc(string str [, int max_chars_per_line]) - Converts logical Hebrew text to visual text with newline conversion */ -PHP_FUNCTION(hebrevc) -{ - php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); + RETURN_NEW_STR(broken_str); } /* }}} */ diff --git a/ext/standard/tests/strings/hebrevc_basic.phpt b/ext/standard/tests/strings/hebrevc_basic.phpt deleted file mode 100644 index 22b3ba3d3eecc..0000000000000 --- a/ext/standard/tests/strings/hebrevc_basic.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test hebrevc() function : basic functionality ---FILE-- -\n'.\nThe function tries to avoid breaking words.\n"; - -var_dump(hebrevc($hebrew_text)); -var_dump(hebrevc($hebrew_text, 15)); - -?> ---EXPECTF-- -*** Testing hebrevc() : basic functionality *** - -Deprecated: Function hebrevc() is deprecated in %s on line %d -string(239) ".The hebrevc function converts logical Hebrew text to visual text
-) This function is similar to hebrev() with the difference that it converts newlines
- -.'
-.The function tries to avoid breaking words
-" - -Deprecated: Function hebrevc() is deprecated in %s on line %d -string(317) "to visual text
-Hebrew text
-logical
-converts
-function
-.The hebrevc
-newlines
-it converts
-difference that
-with the
-to hebrev()
-is similar
-) This function
- -.'
-breaking words
-tries to avoid
-.The function
-" From 1113aabea875d1963cdcb6d9ccdecaf01a7ae882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 17 Nov 2019 21:06:08 +0100 Subject: [PATCH 3/7] Remove convert_cyr_string() function --- ext/opcache/Optimizer/zend_func_info.c | 1 - ext/standard/basic_functions.c | 1 - ext/standard/basic_functions.stub.php | 4 - ext/standard/basic_functions_arginfo.h | 6 - ext/standard/config.m4 | 2 +- ext/standard/config.w32 | 2 +- ext/standard/cyr_convert.c | 284 ------------------ ext/standard/cyr_convert.h | 22 -- ext/standard/php_standard.h | 1 - .../tests/strings/convert_cyr_string.phpt | 50 --- .../strings/convert_cyr_string_basic.phpt | 167 ---------- .../strings/convert_cyr_string_error.phpt | 52 ---- 12 files changed, 2 insertions(+), 590 deletions(-) delete mode 100644 ext/standard/cyr_convert.c delete mode 100644 ext/standard/cyr_convert.h delete mode 100644 ext/standard/tests/strings/convert_cyr_string.phpt delete mode 100644 ext/standard/tests/strings/convert_cyr_string_basic.phpt delete mode 100644 ext/standard/tests/strings/convert_cyr_string_error.phpt diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index d9cc9e1728a0d..bce7d0bca0154 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -333,7 +333,6 @@ static const func_info_t func_infos[] = { #endif F1("quoted_printable_decode", MAY_BE_STRING), F1("quoted_printable_encode", MAY_BE_STRING), - F1("convert_cyr_string", MAY_BE_STRING), F1("get_current_user", MAY_BE_STRING), F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), F0("get_magic_quotes_gpc", MAY_BE_FALSE), diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 49f4f68979508..fd98174d9edf4 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1135,7 +1135,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(quoted_printable_decode, arginfo_quoted_printable_decode) PHP_FE(quoted_printable_encode, arginfo_quoted_printable_encode) - PHP_DEP_FE(convert_cyr_string, arginfo_convert_cyr_string) PHP_FE(get_current_user, arginfo_get_current_user) PHP_FE(set_time_limit, arginfo_set_time_limit) PHP_FE(header_register_callback, arginfo_header_register_callback) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 44f54a071da15..7acc00c602ac3 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -385,10 +385,6 @@ function crc32(string $str): int {} function crypt(string $str, string $salt = UNKNOWN): string {} -/* cyr_convert.c */ - -function convert_cyr_string(string $str, string $from, string $to): string {} - /* datetime.c */ #if HAVE_STRPTIME diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 071ffc1c111f6..e300de5a85b2a 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -598,12 +598,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_crypt, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_convert_cyr_string, 0, 3, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, from, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0) -ZEND_END_ARG_INFO() - #if HAVE_STRPTIME ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strptime, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, timestamp, IS_STRING, 0) diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 5b49e5d661f3c..6a2a232f5f651 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -491,7 +491,7 @@ dnl dnl Setup extension sources dnl PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \ - cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \ + datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \ flock_compat.c formatted_print.c fsock.c head.c html.c image.c \ info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \ microtime.c pack.c pageinfo.c quot_print.c rand.c mt_rand.c \ diff --git a/ext/standard/config.w32 b/ext/standard/config.w32 index 16238f800efdd..a5737ea8538b8 100644 --- a/ext/standard/config.w32 +++ b/ext/standard/config.w32 @@ -26,7 +26,7 @@ ADD_FLAG("LIBS_STANDARD", "iphlpapi.lib"); EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \ crc32.c crypt.c crypt_freesec.c crypt_blowfish.c crypt_sha256.c \ crypt_sha512.c php_crypt_r.c \ - cyr_convert.c datetime.c dir.c dl.c dns.c dns_win32.c exec.c \ + datetime.c dir.c dl.c dns.c dns_win32.c exec.c \ file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \ info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c microtime.c \ net.c pack.c pageinfo.c quot_print.c rand.c mt_rand.c soundex.c \ diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c deleted file mode 100644 index 8f0fa538dd5fe..0000000000000 --- a/ext/standard/cyr_convert.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Kirill Maximov | - +----------------------------------------------------------------------+ - */ - -#include - -#ifdef HAVE_UNISTD_H -#include -#endif -#include -#include - -#include "php.h" -#include "cyr_convert.h" - -#include - -/***************************************************************************** -* This is codetables for different Cyrillic charsets (relative to koi8-r). -* Each table contains data for 128-255 symbols from ASCII table. -* First 256 symbols are for conversion from koi8-r to corresponding charset, -* second 256 symbols are for reverse conversion, from charset to koi8-r. -* -* Here we have the following tables: -* _cyr_win1251 - for windows-1251 charset -* _cyr_iso88595 - for iso8859-5 charset -* _cyr_cp866 - for x-cp866 charset -* _cyr_mac - for x-mac-cyrillic charset -* -*****************************************************************************/ - -typedef unsigned char _cyr_charset_table[512]; - -/* {{{ static const _cyr_charset_table _cyr_win1251 - */ -static const _cyr_charset_table _cyr_win1251 = { -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, -46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, -154,174,190,46,159,189,46,46,179,191,180,157,46,46,156,183, -46,46,182,166,173,46,46,158,163,152,164,155,46,46,46,167, -225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, -242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, -193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, -210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,184,186,32,179,191,32,32,32,32,32,180,162,32, -32,32,32,168,170,32,178,175,32,32,32,32,32,165,161,169, -254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, -239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250, -222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206, -207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218, -}, -_cyr_cp866 = { -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, -242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, -193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, -35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43, -43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45, -45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35, -210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, -179,163,180,164,183,167,190,174,32,149,158,32,152,159,148,154, -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -205,186,213,241,243,201,32,245,187,212,211,200,190,32,247,198, -199,204,181,240,242,185,32,244,203,207,208,202,216,32,246,32, -238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174, -175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234, -158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142, -143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154, -}, -_cyr_iso88595 = { -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, -242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, -193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, -210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, -32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32, -238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222, -223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234, -206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190, -191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202, -}, -_cyr_mac = { -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, -242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, -160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, -176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, -128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, -144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209, -193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, -210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255, -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, -32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, -48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, -64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, -80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, -96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, -112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, -208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, -160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175, -176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191, -254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, -239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250, -158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142, -143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154, -}; -/* }}} */ - -/* {{{ static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to) -* This is the function that performs real in-place conversion of the string -* between charsets. -* Parameters: -* str - string to be converted -* from,to - one-symbol label of source and destination charset -* The following symbols are used as labels: -* k - koi8-r -* w - windows-1251 -* i - iso8859-5 -* a - x-cp866 -* d - x-cp866 -* m - x-mac-cyrillic -*****************************************************************************/ -static char * php_convert_cyr_string(unsigned char *str, size_t length, char from, char to) -{ - const unsigned char *from_table, *to_table; - unsigned char tmp; - size_t i; - - from_table = NULL; - to_table = NULL; - - switch (toupper((int)(unsigned char)from)) - { - case 'W': - from_table = _cyr_win1251; - break; - case 'A': - case 'D': - from_table = _cyr_cp866; - break; - case 'I': - from_table = _cyr_iso88595; - break; - case 'M': - from_table = _cyr_mac; - break; - case 'K': - break; - default: - php_error_docref(NULL, E_WARNING, "Unknown source charset: %c", from); - break; - } - - switch (toupper((int)(unsigned char)to)) - { - case 'W': - to_table = _cyr_win1251; - break; - case 'A': - case 'D': - to_table = _cyr_cp866; - break; - case 'I': - to_table = _cyr_iso88595; - break; - case 'M': - to_table = _cyr_mac; - break; - case 'K': - break; - default: - php_error_docref(NULL, E_WARNING, "Unknown destination charset: %c", to); - break; - } - - - if (!str) - return (char *)str; - - for (i = 0; i < length; i++) { - tmp = (from_table == NULL)? str[i] : from_table[ str[i] ]; - str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256]; - } - return (char *)str; -} -/* }}} */ - -/* {{{ proto string convert_cyr_string(string str, string from, string to) - Convert from one Cyrillic character set to another */ -PHP_FUNCTION(convert_cyr_string) -{ - char *input, *fr_cs, *to_cs; - size_t input_len, fr_cs_len, to_cs_len; - zend_string *str; - - ZEND_PARSE_PARAMETERS_START(3, 3) - Z_PARAM_STRING(input, input_len) - Z_PARAM_STRING(fr_cs, fr_cs_len) - Z_PARAM_STRING(to_cs, to_cs_len) - ZEND_PARSE_PARAMETERS_END(); - - str = zend_string_init(input, input_len, 0); - - php_convert_cyr_string((unsigned char *) ZSTR_VAL(str), ZSTR_LEN(str), fr_cs[0], to_cs[0]); - RETVAL_NEW_STR(str); -} -/* }}} */ diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h deleted file mode 100644 index edbe46b46d653..0000000000000 --- a/ext/standard/cyr_convert.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Copyright (c) The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Kirill Maximov | - +----------------------------------------------------------------------+ -*/ - -#ifndef CYR_CONVERT_H -#define CYR_CONVERT_H - -PHP_FUNCTION(convert_cyr_string); - -#endif /* CYR_CONVERT_H */ diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h index 54375c0739849..21926d316f06f 100644 --- a/ext/standard/php_standard.h +++ b/ext/standard/php_standard.h @@ -35,7 +35,6 @@ #include "microtime.h" #include "url.h" #include "pageinfo.h" -#include "cyr_convert.h" #include "php_link.h" #include "fsock.h" #include "php_image.h" diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt deleted file mode 100644 index 3bbde00cf14af..0000000000000 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -basic convert_cyr_string() tests ---FILE-- - ---EXPECTF-- -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - -Warning: convert_cyr_string(): Unknown source charset: in %s on line %d - -Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d -string(0) "" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - -Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d -string(6) "[[[[[[" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(6) "[[[[[[" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(6) "[[[[[[" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(6) "[[[[[[" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(6) "[[[[[[" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - -Warning: convert_cyr_string(): Unknown destination charset: q in %s on line %d -string(6) "[[[[[[" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(0) "" -Done diff --git a/ext/standard/tests/strings/convert_cyr_string_basic.phpt b/ext/standard/tests/strings/convert_cyr_string_basic.phpt deleted file mode 100644 index 110dccdc1fb1a..0000000000000 --- a/ext/standard/tests/strings/convert_cyr_string_basic.phpt +++ /dev/null @@ -1,167 +0,0 @@ ---TEST-- -Test convert_cyr_string() function : basic functionality ---FILE-- - ---EXPECTF-- -*** Testing convert_cyr_string() : basic functionality *** - --- First try some simple English text -- - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e" - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e" - --- Now try some of characters in 128-255 range -- -128: 2e -129: 2e -130: 2e -131: 2e -132: 2e -133: 2e -134: 2e -135: 2e -136: 2e -137: 2e -138: 2e -139: 2e -140: 2e -141: 2e -142: 2e -143: 2e -144: 2e -145: 2e -146: 2e -147: 2e -148: 2e -149: 2e -150: 2e -151: 2e -152: 2e -153: 2e -154: 2e -155: 2e -156: 2e -157: 2e -158: 2e -159: 2e -160: 9a -161: ae -162: be -163: 2e -164: 9f -165: bd -166: 2e -167: 2e -168: b3 -169: bf -170: b4 -171: 9d -172: 2e -173: 2e -174: 9c -175: b7 -176: 2e -177: 2e -178: b6 -179: a6 -180: ad -181: 2e -182: 2e -183: 9e -184: a3 -185: 98 -186: a4 -187: 9b -188: 2e -189: 2e -190: 2e -191: a7 -192: e1 -193: e2 -194: f7 -195: e7 -196: e4 -197: e5 -198: f6 -199: fa -200: e9 -201: ea -202: eb -203: ec -204: ed -205: ee -206: ef -207: f0 -208: f2 -209: f3 -210: f4 -211: f5 -212: e6 -213: e8 -214: e3 -215: fe -216: fb -217: fd -218: ff -219: f9 -220: f8 -221: fc -222: e0 -223: f1 -224: c1 -225: c2 -226: d7 -227: c7 -228: c4 -229: c5 -230: d6 -231: da -232: c9 -233: ca -234: cb -235: cc -236: cd -237: ce -238: cf -239: d0 -240: d2 -241: d3 -242: d4 -243: d5 -244: c6 -245: c8 -246: c3 -247: de -248: db -249: dd -250: df -251: d9 -252: d8 -253: dc -254: c0 -255: d1 diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt deleted file mode 100644 index 393a778a30399..0000000000000 --- a/ext/standard/tests/strings/convert_cyr_string_error.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test convert_cyr_string() function : error conditions ---FILE-- -", "?")) ); - -?> ---EXPECTF-- -*** Testing convert_cyr_string() : error conditions *** - --- Testing convert_cyr_string() function with invalid 'from' character set -- - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - -Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d -string(10) "68656c6c6f" - --- Testing convert_cyr_string() function with invalid 'to' character set -- - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - -Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d -string(10) "68656c6c6f" - --- Testing convert_cyr_string() function with invalid 'from' and 'to' character set -- - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - -Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d - -Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d -string(10) "68656c6c6f" From d517a7e9303bf43b89d6dafae6a4ac15e77edd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 17 Nov 2019 21:10:37 +0100 Subject: [PATCH 4/7] Remove money_format() function --- configure.ac | 1 - ext/opcache/Optimizer/zend_func_info.c | 3 - ext/standard/basic_functions.c | 4 - ext/standard/basic_functions.stub.php | 4 - ext/standard/basic_functions_arginfo.h | 7 -- ext/standard/php_string.h | 3 - ext/standard/string.c | 52 --------- .../tests/strings/money_format_basic1.phpt | 101 ------------------ .../tests/strings/money_format_error.phpt | 37 ------- ext/standard/tests/strings/moneyformat.phpt | 20 ---- 10 files changed, 232 deletions(-) delete mode 100644 ext/standard/tests/strings/money_format_basic1.phpt delete mode 100644 ext/standard/tests/strings/money_format_error.phpt delete mode 100644 ext/standard/tests/strings/moneyformat.phpt diff --git a/configure.ac b/configure.ac index 19927da679637..aab880319a841 100644 --- a/configure.ac +++ b/configure.ac @@ -634,7 +634,6 @@ statfs \ statvfs \ std_syslog \ strcasecmp \ -strfmon \ strnlen \ strptime \ strtok_r \ diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index bce7d0bca0154..5bf43b277e37c 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -178,9 +178,6 @@ static const func_info_t func_infos[] = { F1("str_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING), F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING), F0("substr_compare", MAY_BE_FALSE | MAY_BE_LONG), -#ifdef HAVE_STRFMON - F1("money_format", MAY_BE_FALSE | MAY_BE_STRING), -#endif FN("substr", MAY_BE_FALSE | MAY_BE_STRING), FN("substr_replace", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING), F1("quotemeta", MAY_BE_STRING), diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index fd98174d9edf4..e690f6e214368 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -932,10 +932,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(utf8_decode, arginfo_utf8_decode) PHP_FE(strcoll, arginfo_strcoll) -#ifdef HAVE_STRFMON - PHP_DEP_FE(money_format, arginfo_money_format) -#endif - PHP_FE(substr, arginfo_substr) PHP_FE(substr_replace, arginfo_substr_replace) PHP_FE(quotemeta, arginfo_quotemeta) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 7acc00c602ac3..7d04970ba9f94 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -669,10 +669,6 @@ function str_shuffle(string $str): string {} function str_word_count(string $str, int $format = 0, string $charlist = UNKNOWN): array|int {} -#ifdef HAVE_STRFMON -function money_format(string $format, float $value): string|false {} -#endif - function str_split(string $str, int $split_length = 1): array {} function strpbrk(string $haystack, string $char_list): string|false {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index e300de5a85b2a..1a7ecf5a1f861 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1052,13 +1052,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_str_word_count, 0, 1, MAY_BE_ARR ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0) ZEND_END_ARG_INFO() -#if defined(HAVE_STRFMON) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_money_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, value, IS_DOUBLE, 0) -ZEND_END_ARG_INFO() -#endif - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_split, 0, 1, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, split_length, IS_LONG, 0) diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index bdeb87b9123a7..6d66e0f1fe978 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -89,9 +89,6 @@ PHP_FUNCTION(substr_compare); PHP_FUNCTION(utf8_encode); PHP_FUNCTION(utf8_decode); PHP_FUNCTION(strcoll); -#if HAVE_STRFMON -PHP_FUNCTION(money_format); -#endif #if defined(ZTS) PHP_MINIT_FUNCTION(localeconv); diff --git a/ext/standard/string.c b/ext/standard/string.c index ed8709d429511..5c770c04cec66 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5930,58 +5930,6 @@ PHP_FUNCTION(str_word_count) /* }}} */ -#if HAVE_STRFMON -/* {{{ proto string|false money_format(string format , float value) - Convert monetary value(s) to string */ -PHP_FUNCTION(money_format) -{ - size_t format_len = 0; - char *format, *p, *e; - double value; - zend_bool check = 0; - zend_string *str; - ssize_t res_len; - - ZEND_PARSE_PARAMETERS_START(2, 2) - Z_PARAM_STRING(format, format_len) - Z_PARAM_DOUBLE(value) - ZEND_PARSE_PARAMETERS_END(); - - p = format; - e = p + format_len; - while ((p = memchr(p, '%', (e - p)))) { - if (*(p + 1) == '%') { - p += 2; - } else if (!check) { - check = 1; - p++; - } else { - php_error_docref(NULL, E_WARNING, "Only a single %%i or %%n token can be used"); - RETURN_FALSE; - } - } - - str = zend_string_safe_alloc(format_len, 1, 1024, 0); - if ((res_len = strfmon(ZSTR_VAL(str), ZSTR_LEN(str), format, value)) < 0) { - zend_string_efree(str); - RETURN_FALSE; - } -#ifdef _AIX - /* - On AIX strfmon seems to include the terminating \0 in the length returned by strfmon, - despite the documentation indicating it is not included. - */ - ZSTR_LEN(str) = strlen(ZSTR_VAL(str)); -#else - ZSTR_LEN(str) = (size_t)res_len; -#endif - ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0'; - - RETURN_NEW_STR(zend_string_truncate(str, ZSTR_LEN(str), 0)); -} -/* }}} */ -#endif - /* {{{ proto array str_split(string str [, int split_length]) Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long. */ PHP_FUNCTION(str_split) diff --git a/ext/standard/tests/strings/money_format_basic1.phpt b/ext/standard/tests/strings/money_format_basic1.phpt deleted file mode 100644 index abf7bcf5087a0..0000000000000 --- a/ext/standard/tests/strings/money_format_basic1.phpt +++ /dev/null @@ -1,101 +0,0 @@ ---TEST-- -Test money_format() function : basic functionality using national currency symbols ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing money_format() : basic functionality*** -Format values with 14 positions, 8 digits to left, 2 to right using national format - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again but with ( for negative values - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format with 0 for padding character - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again with * for padding character - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again but disable grouping character - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string -Format again suppress currency symbol - -Deprecated: Function money_format() is deprecated in %s on line %d -string - -Deprecated: Function money_format() is deprecated in %s on line %d -string diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt deleted file mode 100644 index b462f1b9db7f0..0000000000000 --- a/ext/standard/tests/strings/money_format_error.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test money_format() function : error conditions ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -*** Testing money_format() : error conditions *** - --- Testing money_format() function with more than one token -- - -Deprecated: Function money_format() is deprecated in %s on line %d - -Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d -bool(false) diff --git a/ext/standard/tests/strings/moneyformat.phpt b/ext/standard/tests/strings/moneyformat.phpt deleted file mode 100644 index 9c10148f7db87..0000000000000 --- a/ext/standard/tests/strings/moneyformat.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -money_format test ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: Function money_format() is deprecated in %s on line %d -string(7) "X$3.14Y" From 54605ac414ada915e5b38a9691c6bf860bcfb2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 17 Nov 2019 21:28:17 +0100 Subject: [PATCH 5/7] Remove ezmlm_hash() function --- .../call_to_deprecated_function_args.phpt | 19 ++++++++------- ext/opcache/Optimizer/zend_func_info.c | 1 - ext/standard/basic_functions.c | 1 - ext/standard/basic_functions.stub.php | 2 -- ext/standard/basic_functions_arginfo.h | 2 -- ext/standard/mail.c | 23 ------------------- ext/standard/php_mail.h | 1 - ext/standard/tests/mail/ezmlm_hash_basic.phpt | 23 ------------------- ext/zend_test/test.c | 12 ++++++++++ 9 files changed, 23 insertions(+), 61 deletions(-) delete mode 100644 ext/standard/tests/mail/ezmlm_hash_basic.phpt diff --git a/Zend/tests/call_to_deprecated_function_args.phpt b/Zend/tests/call_to_deprecated_function_args.phpt index 5c3eb9ae16103..c7781e30e0acb 100644 --- a/Zend/tests/call_to_deprecated_function_args.phpt +++ b/Zend/tests/call_to_deprecated_function_args.phpt @@ -1,5 +1,8 @@ --TEST-- Check that arguments are freed when calling a deprecated function +--SKIPIF-- +getMessage(), "\n"; } $ret = new stdClass; try { - $ret = ezmlm_hash(new stdClass); + $ret = zend_test_deprecated(new stdClass()); } catch (Error $e) { echo $e->getMessage(), "\n"; } try { - $fn = 'ezmlm_hash'; + $fn = 'zend_test_deprecated'; $fn(new stdClass); } catch (Error $e) { echo $e->getMessage(), "\n"; @@ -29,7 +32,7 @@ try { $ret = new stdClass; try { - $fn = 'ezmlm_hash'; + $fn = 'zend_test_deprecated'; $ret = $fn(new stdClass); } catch (Error $e) { echo $e->getMessage(), "\n"; @@ -37,7 +40,7 @@ try { ?> --EXPECT-- -Function ezmlm_hash() is deprecated -Function ezmlm_hash() is deprecated -Function ezmlm_hash() is deprecated -Function ezmlm_hash() is deprecated +Function zend_test_deprecated() is deprecated +Function zend_test_deprecated() is deprecated +Function zend_test_deprecated() is deprecated +Function zend_test_deprecated() is deprecated diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index 5bf43b277e37c..e4e05f35e8afc 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -532,7 +532,6 @@ static const func_info_t func_infos[] = { F0("realpath_cache_size", MAY_BE_LONG), F1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY), F0("mail", MAY_BE_FALSE | MAY_BE_TRUE), - F0("ezmlm_hash", MAY_BE_LONG), #ifdef HAVE_SYSLOG_H F0("closelog", MAY_BE_TRUE), #endif diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e690f6e214368..66c709b962a54 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1415,7 +1415,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ /* functions from mail.c */ PHP_FE(mail, arginfo_mail) - PHP_DEP_FE(ezmlm_hash, arginfo_ezmlm_hash) /* functions from syslog.c */ #ifdef HAVE_SYSLOG_H diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 7d04970ba9f94..0adcee8ea7505 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -845,8 +845,6 @@ function link(string $target, string $link): bool {} /* mail.c */ -function ezmlm_hash(string $str): int {} - /** @param string|array $additional_headers */ function mail(string $to, string $subject, string $message, $additional_headers = UNKNOWN, string $additional_parameters = ""): bool {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 1a7ecf5a1f861..18e1467a62376 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1287,8 +1287,6 @@ ZEND_END_ARG_INFO() #define arginfo_link arginfo_symlink #endif -#define arginfo_ezmlm_hash arginfo_crc32 - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mail, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 775cd0da54e23..b6f987d80f8ae 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -64,29 +64,6 @@ extern zend_long php_getuid(void); -/* {{{ proto int ezmlm_hash(string addr) - Calculate EZMLM list hash value. */ -PHP_FUNCTION(ezmlm_hash) -{ - char *str = NULL; - unsigned int h = 5381; - size_t j, str_len; - - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_STRING(str, str_len) - ZEND_PARSE_PARAMETERS_END(); - - for (j = 0; j < str_len; j++) { - h = (h + (h << 5)) ^ (zend_ulong) (unsigned char) tolower(str[j]); - } - - h = (h % 53); - - RETURN_LONG((zend_long) h); -} -/* }}} */ - - static zend_bool php_mail_build_headers_check_field_value(zval *val) { size_t len = 0; diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h index 12203830c6edb..0e226ba6a1a2e 100644 --- a/ext/standard/php_mail.h +++ b/ext/standard/php_mail.h @@ -18,7 +18,6 @@ #define PHP_MAIL_H PHP_FUNCTION(mail); -PHP_FUNCTION(ezmlm_hash); PHP_MINFO_FUNCTION(mail); diff --git a/ext/standard/tests/mail/ezmlm_hash_basic.phpt b/ext/standard/tests/mail/ezmlm_hash_basic.phpt deleted file mode 100644 index 31c1019c7ad7e..0000000000000 --- a/ext/standard/tests/mail/ezmlm_hash_basic.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Test ezmlm_hash() function : basic functionality ---FILE-- - ---EXPECTF-- -*** Testing ezmlm_hash() : basic functionality *** - -Deprecated: Function ezmlm_hash() is deprecated in %s on line %d -int(1) - -Deprecated: Function ezmlm_hash() is deprecated in %s on line %d -int(7) diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c index 318419ba3e37b..b4a5ad927a99b 100644 --- a/ext/zend_test/test.c +++ b/ext/zend_test/test.c @@ -38,6 +38,10 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_void_return, IS_VOID, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_deprecated, IS_VOID, 0) + ZEND_ARG_INFO(0, arg1) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_terminate_string, 0, 0, 1) ZEND_ARG_INFO(1, str) ZEND_END_ARG_INFO() @@ -76,6 +80,13 @@ ZEND_FUNCTION(zend_test_void_return) /* dummy */ } +ZEND_FUNCTION(zend_test_deprecated) +{ + zval *arg1; + + zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg1); +} + /* Create a string without terminating null byte. Must be termined with * zend_terminate_string() before destruction, otherwise a warning is issued * in debug builds. */ @@ -322,6 +333,7 @@ static const zend_function_entry zend_test_functions[] = { ZEND_FE(zend_test_array_return, arginfo_zend_test_array_return) ZEND_FE(zend_test_nullable_array_return, arginfo_zend_test_nullable_array_return) ZEND_FE(zend_test_void_return, arginfo_zend_test_void_return) + ZEND_DEP_FE(zend_test_deprecated, arginfo_zend_test_deprecated) ZEND_FE(zend_create_unterminated_string, NULL) ZEND_FE(zend_terminate_string, arginfo_zend_terminate_string) ZEND_FE(zend_leak_bytes, NULL) From b8308c1918d9e1de6cb750cbd7525bde9bad2a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 17 Nov 2019 21:34:52 +0100 Subject: [PATCH 6/7] Remove magic quotes legacy --- ext/opcache/Optimizer/sccp.c | 4 +-- ext/opcache/Optimizer/zend_func_info.c | 2 -- ext/standard/basic_functions.c | 25 ------------------- ext/standard/basic_functions.h | 2 -- ext/standard/basic_functions.stub.php | 4 --- ext/standard/basic_functions_arginfo.h | 4 --- .../tests/general_functions/bug55371.phpt | 16 ------------ 7 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 ext/standard/tests/general_functions/bug55371.phpt diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c index 57ae48b0217ca..9c21f35d70ec9 100644 --- a/ext/opcache/Optimizer/sccp.c +++ b/ext/opcache/Optimizer/sccp.c @@ -786,9 +786,7 @@ static inline int ct_eval_func_call( int overflow; if (num_args == 0) { - if (zend_string_equals_literal(name, "get_magic_quotes_gpc") - || zend_string_equals_literal(name, "get_magic_quotes_gpc_runtime") - || zend_string_equals_literal(name, "php_sapi_name") + if (zend_string_equals_literal(name, "php_sapi_name") || zend_string_equals_literal(name, "imagetypes") || zend_string_equals_literal(name, "phpversion")) { /* pass */ diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index e4e05f35e8afc..7dcb664aeb21a 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -332,8 +332,6 @@ static const func_info_t func_infos[] = { F1("quoted_printable_encode", MAY_BE_STRING), F1("get_current_user", MAY_BE_STRING), F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), - F0("get_magic_quotes_gpc", MAY_BE_FALSE), - F0("get_magic_quotes_runtime", MAY_BE_FALSE), F0("error_log", MAY_BE_FALSE | MAY_BE_TRUE), F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING), FN("call_user_func", UNKNOWN_INFO), diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 66c709b962a54..e5a5f94b1ae55 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1136,9 +1136,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(header_register_callback, arginfo_header_register_callback) PHP_FE(get_cfg_var, arginfo_get_cfg_var) - PHP_DEP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc) - PHP_DEP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime) - PHP_FE(error_log, arginfo_error_log) PHP_FE(error_get_last, arginfo_error_get_last) PHP_FE(error_clear_last, arginfo_error_clear_last) @@ -2881,28 +2878,6 @@ PHP_FUNCTION(get_cfg_var) } /* }}} */ -/* {{{ proto false get_magic_quotes_runtime(void) - Get the current active configuration setting of magic_quotes_runtime */ -PHP_FUNCTION(get_magic_quotes_runtime) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto false get_magic_quotes_gpc(void) - Get the current active configuration setting of magic_quotes_gpc */ -PHP_FUNCTION(get_magic_quotes_gpc) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - RETURN_FALSE; -} -/* }}} */ - /* 1st arg = error message 2nd arg = error option diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 140a51dde2a7a..a010db88f680b 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -72,8 +72,6 @@ PHP_FUNCTION(set_time_limit); PHP_FUNCTION(header_register_callback); PHP_FUNCTION(get_cfg_var); -PHP_FUNCTION(get_magic_quotes_runtime); -PHP_FUNCTION(get_magic_quotes_gpc); PHP_FUNCTION(error_log); PHP_FUNCTION(error_get_last); diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 0adcee8ea7505..b09da99f95f55 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -273,10 +273,6 @@ function get_current_user(): string {} function get_cfg_var(string $option_name): string|array|false {} -function get_magic_quotes_runtime(): bool {} - -function get_magic_quotes_gpc(): bool {} - function error_log(string $message, int $message_type = 0, string $destination = UNKNOWN, string $extra_headers = UNKNOWN): bool {} function error_get_last(): ?array {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 18e1467a62376..2b499cc4a0e71 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -427,10 +427,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_cfg_var, 0, 1, MAY_BE_STRING ZEND_ARG_TYPE_INFO(0, option_name, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_get_magic_quotes_runtime arginfo_ob_flush - -#define arginfo_get_magic_quotes_gpc arginfo_ob_flush - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_log, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, message_type, IS_LONG, 0) diff --git a/ext/standard/tests/general_functions/bug55371.phpt b/ext/standard/tests/general_functions/bug55371.phpt deleted file mode 100644 index 5b324db599603..0000000000000 --- a/ext/standard/tests/general_functions/bug55371.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning) ---FILE-- - ---EXPECTF-- -Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d - -Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d -done From 0afe10bd628b4f6d0defe3fc06d22fc53683b316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 18 Nov 2019 14:13:12 +0100 Subject: [PATCH 7/7] Remove FILTER_SANITIZE_MAGIC_QUOTES filter --- ext/filter/filter.c | 2 -- ext/filter/filter_private.h | 1 - ext/filter/php_filter.h | 1 - ext/filter/sanitizing_filters.c | 14 -------------- ext/filter/tests/008.phpt | 6 ++---- ext/filter/tests/020.phpt | 27 --------------------------- ext/filter/tests/033.phpt | 21 --------------------- 7 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 ext/filter/tests/020.phpt diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 5ea4a086f175a..23ef0bdf9bcf6 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -57,7 +57,6 @@ static const filter_list_entry filter_list[] = { { "url", FILTER_SANITIZE_URL, php_filter_url }, { "number_int", FILTER_SANITIZE_NUMBER_INT, php_filter_number_int }, { "number_float", FILTER_SANITIZE_NUMBER_FLOAT, php_filter_number_float }, - { "magic_quotes", FILTER_SANITIZE_MAGIC_QUOTES, php_filter_magic_quotes }, { "add_slashes", FILTER_SANITIZE_ADD_SLASHES, php_filter_add_slashes }, { "callback", FILTER_CALLBACK, php_filter_callback }, @@ -213,7 +212,6 @@ PHP_MINIT_FUNCTION(filter) REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ADD_SLASHES", FILTER_SANITIZE_ADD_SLASHES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT); diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h index 3f2fd4a0f91b1..5dcbd5c3cc373 100644 --- a/ext/filter/filter_private.h +++ b/ext/filter/filter_private.h @@ -79,7 +79,6 @@ #define FILTER_SANITIZE_URL 0x0206 #define FILTER_SANITIZE_NUMBER_INT 0x0207 #define FILTER_SANITIZE_NUMBER_FLOAT 0x0208 -#define FILTER_SANITIZE_MAGIC_QUOTES 0x0209 #define FILTER_SANITIZE_FULL_SPECIAL_CHARS 0x020a #define FILTER_SANITIZE_ADD_SLASHES 0x020b #define FILTER_SANITIZE_LAST 0x020b diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h index 1a544fe4357c9..2a923ab953f96 100644 --- a/ext/filter/php_filter.h +++ b/ext/filter/php_filter.h @@ -90,7 +90,6 @@ void php_filter_url(PHP_INPUT_FILTER_PARAM_DECL); void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL); void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL); void php_filter_add_slashes(PHP_INPUT_FILTER_PARAM_DECL); -void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL); void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL); diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c index f12cec9c49c2d..a39213d52f7b6 100644 --- a/ext/filter/sanitizing_filters.c +++ b/ext/filter/sanitizing_filters.c @@ -373,17 +373,3 @@ void php_filter_add_slashes(PHP_INPUT_FILTER_PARAM_DECL) ZVAL_STR(value, buf); } /* }}} */ - -/* {{{ php_filter_magic_quotes */ -void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL) -{ - zend_string *buf; - php_error_docref(NULL, E_DEPRECATED, - "FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead"); - - buf = php_addslashes(Z_STR_P(value)); - - zval_ptr_dtor(value); - ZVAL_STR(value, buf); -} -/* }}} */ diff --git a/ext/filter/tests/008.phpt b/ext/filter/tests/008.phpt index b34c977425f6a..75e0968c620a1 100644 --- a/ext/filter/tests/008.phpt +++ b/ext/filter/tests/008.phpt @@ -10,7 +10,7 @@ var_dump(filter_list()); echo "Done\n"; ?> --EXPECTF-- -array(22) { +array(21) { [0]=> string(3) "int" [1]=> @@ -50,10 +50,8 @@ array(22) { [18]=> string(12) "number_float" [19]=> - string(12) "magic_quotes" - [20]=> string(11) "add_slashes" - [21]=> + [20]=> string(8) "callback" } Done diff --git a/ext/filter/tests/020.phpt b/ext/filter/tests/020.phpt deleted file mode 100644 index 5c2ec5bfb2773..0000000000000 --- a/ext/filter/tests/020.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -filter_var() and FILTER_SANITIZE_MAGIC_QUOTES ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d -string(36) "test\'asd\'asd\'\' asd\\\'\"asdfasdf" - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d -string(2) "\'" - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d -string(0) "" - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d -string(2) "-1" -Done diff --git a/ext/filter/tests/033.phpt b/ext/filter/tests/033.phpt index 83ae4a3c19f08..0791a74de9fb3 100644 --- a/ext/filter/tests/033.phpt +++ b/ext/filter/tests/033.phpt @@ -29,26 +29,5 @@ email PHP 1 foo@bar.com httpa.b.c 1.2.3.4 123 12 url PHP 1 foo@bar.com http://a.b.c 1.2.3.4 123 123abc<>() O'Henry aa:bb:cc:dd:ee:ff number_int 1 1234 123 123 number_float 1 1234 123 123 - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d - -Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d -magic_quotes PHP 1 foo@bar.com http://a.b.c 1.2.3.4 123 123abc<>() O\'Henry 하퍼 aa:bb:cc:dd:ee:ff add_slashes PHP 1 foo@bar.com http://a.b.c 1.2.3.4 123 123abc<>() O\'Henry 하퍼 aa:bb:cc:dd:ee:ff callback PHP 1 FOO@BAR.COM HTTP://A.B.C 1.2.3.4 123 123ABC<>() O'HENRY 하퍼 AA:BB:CC:DD:EE:FF