From: Nikita Popov Date: Fri, 12 Jul 2019 10:14:02 +0000 (+0200) Subject: Deprecate convert_cyr_string() X-Git-Tag: php-7.4.0beta1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3668aabf7d9bf1444edbbd13fe20de5d89e008e;p=php Deprecate convert_cyr_string() --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 42815ca6f1..0395b41358 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -3005,7 +3005,7 @@ 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_FE(convert_cyr_string, arginfo_convert_cyr_string) + 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/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt index af239543c5..01bd0f50fc 100644 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ b/ext/standard/tests/strings/convert_cyr_string.phpt @@ -3,9 +3,6 @@ basic convert_cyr_string() tests --FILE-- --EXPECTF-- -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL +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() expects parameter 1 to be string, array given in %s on line %d NULL +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 index 8a368e17ef..f4c7f69918 100644 --- a/ext/standard/tests/strings/convert_cyr_string_basic.phpt +++ b/ext/standard/tests/strings/convert_cyr_string_basic.phpt @@ -21,16 +21,20 @@ echo "\n-- Now try some of characters in 128-255 range --\n"; for ($i = 128; $i < 256; $i++) { $str = chr($i); - echo "$i: " . bin2hex(convert_cyr_string($str, 'w', 'k')) . "\n"; + echo "$i: " . bin2hex(@convert_cyr_string($str, 'w', 'k')) . "\n"; } ?> ===DONE=== ---EXPECT-- +--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 -- diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt index 66effea430..0444183ba1 100644 --- a/ext/standard/tests/strings/convert_cyr_string_error.phpt +++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt @@ -15,15 +15,6 @@ $extra_arg = 10; echo "*** Testing convert_cyr_string() : error conditions ***\n"; -echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; -var_dump( convert_cyr_string() ); - -echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; -var_dump( convert_cyr_string($str, $from) ); - -echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; -var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); - echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); @@ -38,33 +29,24 @@ var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); --EXPECTF-- *** Testing convert_cyr_string() : error conditions *** --- Testing convert_cyr_string() function with no arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with no 'to' character set -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with more than expected no. of arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- 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