diff --git a/NEWS b/NEWS index 8ba0a1f5f20..1746e364db4 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,9 @@ PHP NEWS . Backwards-compatible mappings for 0x5C/0x7E in Shift-JIS are restored, after they had been changed in 8.1.0. (Alex Dowad) +- Standard: + . Deprecated utf8_encode() and utf8_decode(). (Rowan Tommins) + 09 Jun 2022, PHP 8.2.0alpha1 - CLI: diff --git a/UPGRADING b/UPGRADING index 95031b93c6d..dc770ff148a 100644 --- a/UPGRADING +++ b/UPGRADING @@ -151,6 +151,10 @@ PHP 8.2 UPGRADE NOTES - SPL: . The SplFileInfo::_bad_state_ex() internal method has been deprecated. + +- Standard: + . utf8_encode() and utf8_decode() have been deprecated. + ======================================== 5. Changed Functions ======================================== diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_005p.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_005p.phpt index f61bc2393b0..ebed16ce89a 100644 --- a/ext/soap/tests/interop/Round2/Base/r2_base_005p.phpt +++ b/ext/soap/tests/interop/Round2/Base/r2_base_005p.phpt @@ -5,7 +5,7 @@ soap --FILE-- "test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0)); -$client->__soapCall("echoString", array(utf8_encode('ỗÈéóÒ₧⅜ỗỸ')), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/")); +$client->__soapCall("echoString", array('ỗÈéóÒ₧⅜ỗỸ'), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/")); echo $client->__getlastrequest(); $HTTP_RAW_POST_DATA = $client->__getlastrequest(); include("round2_base.inc"); @@ -13,7 +13,7 @@ echo "ok\n"; ?> --EXPECT-- -ỗÈéóÒ₧⅜ỗỸ +ỗÈéóÒ₧⅜ỗỸ -ỗÈéóÒ₧⅜ỗỸ +ỗÈéóÒ₧⅜ỗỸ ok diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_005s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_005s.phpt index 9dbfbb8bf7e..6c76c2d5ed9 100644 --- a/ext/soap/tests/interop/Round2/Base/r2_base_005s.phpt +++ b/ext/soap/tests/interop/Round2/Base/r2_base_005s.phpt @@ -5,7 +5,7 @@ soap --FILE-- "test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0)); -$client->__soapCall("echoString", array(new SoapParam(new SoapVar(utf8_encode('ỗÈéóÒ₧⅜ỗỸ'),XSD_STRING),"inputString")), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/")); +$client->__soapCall("echoString", array(new SoapParam(new SoapVar('ỗÈéóÒ₧⅜ỗỸ',XSD_STRING),"inputString")), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/")); echo $client->__getlastrequest(); $HTTP_RAW_POST_DATA = $client->__getlastrequest(); include("round2_base.inc"); @@ -13,7 +13,7 @@ echo "ok\n"; ?> --EXPECT-- -ỗÈéóÒ₧⅜ỗỸ +ỗÈéóÒ₧⅜ỗỸ -ỗÈéóÒ₧⅜ỗỸ +ỗÈéóÒ₧⅜ỗỸ ok diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt index 0252ebcffe0..6c2da485c2b 100644 --- a/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt +++ b/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt @@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0 --FILE-- 1,"exceptions"=>0)); -$client->echoString(utf8_encode('ỗÈéóÒ₧⅜ỗỸ')); +$client->echoString('ỗÈéóÒ₧⅜ỗỸ'); echo $client->__getlastrequest(); $HTTP_RAW_POST_DATA = $client->__getlastrequest(); include("round2_base.inc"); @@ -15,7 +15,7 @@ echo "ok\n"; ?> --EXPECT-- -ỗÈéóÒ₧⅜ỗỸ +ỗÈéóÒ₧⅜ỗỸ -ỗÈéóÒ₧⅜ỗỸ +ỗÈéóÒ₧⅜ỗỸ ok diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 7cbb0b17425..cbdda2bde3c 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -1021,10 +1021,16 @@ function strpbrk(string $string, string $characters): string|false {} function substr_compare(string $haystack, string $needle, int $offset, ?int $length = null, bool $case_insensitive = false): int {} -/** @refcount 1 */ +/** + * @refcount 1 + * @deprecated + */ function utf8_encode(string $string): string {} -/** @refcount 1 */ +/** + * @refcount 1 + * @deprecated + */ function utf8_decode(string $string): string {} /* dir.c */ diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index cc0513a72a2..f72d95e08c2 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0be859a950e082bb02f747630068ea658c6673dd */ + * Stub hash: f35440fd9902dd0201fbaa9005bc51c5aecadf2c */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) @@ -3164,8 +3164,8 @@ static const zend_function_entry ext_functions[] = { ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(str_split, arginfo_str_split) ZEND_FE(strpbrk, arginfo_strpbrk) ZEND_FE(substr_compare, arginfo_substr_compare) - ZEND_FE(utf8_encode, arginfo_utf8_encode) - ZEND_FE(utf8_decode, arginfo_utf8_decode) + ZEND_DEP_FE(utf8_encode, arginfo_utf8_encode) + ZEND_DEP_FE(utf8_decode, arginfo_utf8_decode) ZEND_FE(opendir, arginfo_opendir) ZEND_FE(dir, arginfo_dir) ZEND_FE(closedir, arginfo_closedir) diff --git a/ext/standard/tests/strings/bug20934.phpt b/ext/standard/tests/strings/bug20934.phpt index 121d9b6ecb1..e068d2a6ecd 100644 --- a/ext/standard/tests/strings/bug20934.phpt +++ b/ext/standard/tests/strings/bug20934.phpt @@ -2,10 +2,10 @@ Bug #20934 (htmlspecialchars returns latin1 from UTF-8) --FILE-- ---EXPECT-- -string(2) "àá" -string(2) "àá" +--EXPECTF-- +c3a0c3a1 +c3a0c3a1 diff --git a/ext/standard/tests/strings/bug43957.phpt b/ext/standard/tests/strings/bug43957.phpt index b74b83a1377..8a50fe88158 100644 --- a/ext/standard/tests/strings/bug43957.phpt +++ b/ext/standard/tests/strings/bug43957.phpt @@ -4,5 +4,6 @@ Bug #43957 (utf8_decode() bogus conversion on multibyte indicator near end of st ---EXPECT-- +--EXPECTF-- +Deprecated: Function utf8_decode() is deprecated in %s on line %d abc? diff --git a/ext/standard/tests/strings/bug49687.phpt b/ext/standard/tests/strings/bug49687.phpt index b4f7ac6673e..a23019c015d 100644 --- a/ext/standard/tests/strings/bug49687.phpt +++ b/ext/standard/tests/strings/bug49687.phpt @@ -13,8 +13,13 @@ foreach ($tests as $t) { } echo "Done.\n"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function utf8_decode() is deprecated in %s on line %d 413f3e42 + +Deprecated: Function utf8_decode() is deprecated in %s on line %d 3f22 + +Deprecated: Function utf8_decode() is deprecated in %s on line %d 413f3f423f433f3f Done. diff --git a/ext/standard/tests/strings/utf8.phpt b/ext/standard/tests/strings/utf8.phpt index aea04fdecd8..45b34a277c2 100644 --- a/ext/standard/tests/strings/utf8.phpt +++ b/ext/standard/tests/strings/utf8.phpt @@ -5,6 +5,9 @@ UTF-8<->ISO Latin 1 encoding/decoding test printf("%s -> %s\n", urlencode("æ"), urlencode(utf8_encode("æ"))); printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6"); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function utf8_encode() is deprecated in %s on line %d %E6 -> %C3%A6 + +Deprecated: Function utf8_decode() is deprecated in %s on line %d %E6 <- %C3%A6