Skip to content

Commit 2b6ef67

Browse files
committed
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
1 parent 5a6436f commit 2b6ef67

File tree

9 files changed

+35
-12
lines changed

9 files changed

+35
-12
lines changed

ext/soap/tests/interop/Round2/Base/r2_base_005p.phpt

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ $HTTP_RAW_POST_DATA = $client->__getlastrequest();
1111
include("round2_base.inc");
1212
echo "ok\n";
1313
?>
14-
--EXPECT--
14+
--EXPECTF--
15+
Deprecated: Function utf8_encode() is deprecated in %s on line %d
1516
<?xml version="1.0" encoding="UTF-8"?>
1617
<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>
1718
<?xml version="1.0" encoding="UTF-8"?>

ext/soap/tests/interop/Round2/Base/r2_base_005s.phpt

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ $HTTP_RAW_POST_DATA = $client->__getlastrequest();
1111
include("round2_base.inc");
1212
echo "ok\n";
1313
?>
14-
--EXPECT--
14+
--EXPECTF--
15+
Deprecated: Function utf8_encode() is deprecated in %s on line %d
1516
<?xml version="1.0" encoding="UTF-8"?>
1617
<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>
1718
<?xml version="1.0" encoding="UTF-8"?>

ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ $HTTP_RAW_POST_DATA = $client->__getlastrequest();
1313
include("round2_base.inc");
1414
echo "ok\n";
1515
?>
16-
--EXPECT--
16+
--EXPECTF--
17+
Deprecated: Function utf8_encode() is deprecated in %s on line %d
1718
<?xml version="1.0" encoding="UTF-8"?>
1819
<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>
1920
<?xml version="1.0" encoding="UTF-8"?>

ext/standard/basic_functions.stub.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -1021,10 +1021,16 @@ function strpbrk(string $string, string $characters): string|false {}
10211021

10221022
function substr_compare(string $haystack, string $needle, int $offset, ?int $length = null, bool $case_insensitive = false): int {}
10231023

1024-
/** @refcount 1 */
1024+
/**
1025+
* @refcount 1
1026+
* @deprecated
1027+
*/
10251028
function utf8_encode(string $string): string {}
10261029

1027-
/** @refcount 1 */
1030+
/**
1031+
* @refcount 1
1032+
* @deprecated
1033+
*/
10281034
function utf8_decode(string $string): string {}
10291035

10301036
/* dir.c */

ext/standard/basic_functions_arginfo.h

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/standard/tests/strings/bug20934.phpt

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ $str = utf8_encode("\xe0\xe1");
66
var_dump(utf8_decode($str));
77
var_dump(utf8_decode(htmlspecialchars($str, ENT_COMPAT, "UTF-8")));
88
?>
9-
--EXPECT--
9+
--EXPECTF--
10+
Deprecated: Function utf8_encode() is deprecated in %s on line %d
11+
12+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
1013
string(2) "àá"
14+
15+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
1116
string(2) "àá"

ext/standard/tests/strings/bug43957.phpt

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ Bug #43957 (utf8_decode() bogus conversion on multibyte indicator near end of st
44
<?php
55
echo utf8_decode('abc'.chr(0xe0));
66
?>
7-
--EXPECT--
7+
--EXPECTF--
8+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
89
abc?

ext/standard/tests/strings/bug49687.phpt

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ foreach ($tests as $t) {
1313
}
1414
echo "Done.\n";
1515
?>
16-
--EXPECT--
16+
--EXPECTF--
17+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
1718
413f3e42
19+
20+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
1821
3f22
22+
23+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
1924
413f3f423f433f3f
2025
Done.

ext/standard/tests/strings/utf8.phpt

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ UTF-8<->ISO Latin 1 encoding/decoding test
55
printf("%s -> %s\n", urlencode("æ"), urlencode(utf8_encode("æ")));
66
printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6");
77
?>
8-
--EXPECT--
8+
--EXPECTF--
9+
Deprecated: Function utf8_encode() is deprecated in %s on line %d
910
%E6 -> %C3%A6
11+
12+
Deprecated: Function utf8_decode() is deprecated in %s on line %d
1013
%E6 <- %C3%A6

0 commit comments

Comments
 (0)