mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Add deprecation notices to utf8_encode and utf8_decode
Implements initial stage of accepted RFC to remove them: https://wiki.php.net/rfc/remove_utf8_decode_and_utf8_encode Tests relating to SOAP and htmlspecialchars seem to have been using this entirely unnecessarily, so have been fixed. Closes GH-8726.
This commit is contained in:
parent
e79046fbe4
commit
d9f3ca705c
3
NEWS
3
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:
|
||||
|
@ -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
|
||||
========================================
|
||||
|
@ -5,7 +5,7 @@ soap
|
||||
--FILE--
|
||||
<?php
|
||||
$client = new SoapClient(NULL,array("location"=>"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--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoString><param0 xsi:type="xsd:string">á»ÃéóÃâ§â
á»á»¸</param0></ns1:echoString></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoString><param0 xsi:type="xsd:string">ỗÈéóÒ₧⅜ỗỸ</param0></ns1:echoString></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringResponse><outputString xsi:type="xsd:string">á»ÃéóÃâ§â
á»á»¸</outputString></ns1:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringResponse><outputString xsi:type="xsd:string">ỗÈéóÒ₧⅜ỗỸ</outputString></ns1:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
||||
|
@ -5,7 +5,7 @@ soap
|
||||
--FILE--
|
||||
<?php
|
||||
$client = new SoapClient(NULL,array("location"=>"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--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoString><inputString xsi:type="xsd:string">á»ÃéóÃâ§â
á»á»¸</inputString></ns1:echoString></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoString><inputString xsi:type="xsd:string">ỗÈéóÒ₧⅜ỗỸ</inputString></ns1:echoString></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringResponse><outputString xsi:type="xsd:string">á»ÃéóÃâ§â
á»á»¸</outputString></ns1:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringResponse><outputString xsi:type="xsd:string">ỗÈéóÒ₧⅜ỗỸ</outputString></ns1:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
||||
|
@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0
|
||||
--FILE--
|
||||
<?php
|
||||
$client = new SoapClient(__DIR__."/round2_base.wsdl",array("trace"=>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--
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoString><inputString xsi:type="xsd:string">á»ÃéóÃâ§â
á»á»¸</inputString></ns1:echoString></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoString><inputString xsi:type="xsd:string">ỗÈéóÒ₧⅜ỗỸ</inputString></ns1:echoString></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringResponse><outputString xsi:type="xsd:string">á»ÃéóÃâ§â
á»á»¸</outputString></ns1:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soapinterop.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoStringResponse><outputString xsi:type="xsd:string">ỗÈéóÒ₧⅜ỗỸ</outputString></ns1:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
||||
ok
|
||||
|
@ -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 */
|
||||
|
6
ext/standard/basic_functions_arginfo.h
generated
6
ext/standard/basic_functions_arginfo.h
generated
@ -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)
|
||||
|
@ -2,10 +2,10 @@
|
||||
Bug #20934 (htmlspecialchars returns latin1 from UTF-8)
|
||||
--FILE--
|
||||
<?php
|
||||
$str = utf8_encode("\xe0\xe1");
|
||||
var_dump(utf8_decode($str));
|
||||
var_dump(utf8_decode(htmlspecialchars($str, ENT_COMPAT, "UTF-8")));
|
||||
$str = "\xc3\xa0\xc3\xa1";
|
||||
echo bin2hex($str), "\n";
|
||||
echo bin2hex(htmlspecialchars($str, ENT_COMPAT, "UTF-8")), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) "àá"
|
||||
string(2) "àá"
|
||||
--EXPECTF--
|
||||
c3a0c3a1
|
||||
c3a0c3a1
|
||||
|
@ -4,5 +4,6 @@ Bug #43957 (utf8_decode() bogus conversion on multibyte indicator near end of st
|
||||
<?php
|
||||
echo utf8_decode('abc'.chr(0xe0));
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: Function utf8_decode() is deprecated in %s on line %d
|
||||
abc?
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user