Skip to content

Convert E_STRICT into E_NOTICE for htmlentities function in standard ext #4407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle

if (all) { /* replace with all named entities */
if (CHARSET_PARTIAL_SUPPORT(charset)) {
php_error_docref(NULL, E_STRICT, "Only basic entities "
php_error_docref(NULL, E_NOTICE, "Only basic entities "
"substitution is supported for multi-byte encodings other than UTF-8; "
"functionality is equivalent to htmlspecialchars");
}
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/strings/htmlentities04.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ internal_encoding=pass
var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
?>
--EXPECTF--
Strict Standards: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
string(6) "������"
5 changes: 3 additions & 2 deletions ext/standard/tests/strings/htmlentities08.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
htmlentities() test 8 (mbstring / EUC-JP)
--INI--
output_handler=
error_reporting=~E_STRICT
internal_encoding=EUC-JP
--SKIPIF--
<?php
Expand All @@ -13,6 +12,8 @@ internal_encoding=EUC-JP
print mb_internal_encoding()."\n";
var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
?>
--EXPECT--
--EXPECTF--
EUC-JP

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
string(6) "������"
5 changes: 3 additions & 2 deletions ext/standard/tests/strings/htmlentities09.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
htmlentities() test 9 (mbstring / Shift_JIS)
--INI--
output_handler=
error_reporting=~E_STRICT
internal_encoding=Shift_JIS
--SKIPIF--
<?php
Expand All @@ -14,7 +13,9 @@ internal_encoding=Shift_JIS
var_dump(bin2hex(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '')));
?>
===DONE===
--EXPECT--
--EXPECTF--
SJIS

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
string(12) "814181428143"
===DONE===
2 changes: 1 addition & 1 deletion ext/standard/tests/strings/htmlentities13.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ filter.default=unsafe_raw
--EXPECTF--
EUC-JP

Strict Standards: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d
string(6) "������"
2 changes: 1 addition & 1 deletion ext/standard/tests/strings/htmlentities14.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ filter.default=unsafe_raw
--EXPECTF--
Shift_JIS

Strict Standards: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s on line %d
string(6) "�A�B�C"
116 changes: 113 additions & 3 deletions ext/standard/tests/strings/htmlentities21.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ $tests = array(
function test($flag, $charset) {
global $tests;
$i = -1;
error_reporting(-1 & ~E_STRICT);
foreach ($tests as $test) {
$test = chr($test);
$i++;
Expand All @@ -31,7 +30,6 @@ function test($flag, $charset) {
if ($a == "" && $b == "") { echo sprintf("%05X", $tests[$i]), ": INVALID SEQUENCE\n"; continue; }
echo sprintf("%05X", $tests[$i]), ": ", bin2hex($a), " ", bin2hex($b), "\n";
}
error_reporting(-1);
}

echo "*** Testing HTML 4.01/Windows-1251 ***\n";
Expand Down Expand Up @@ -68,7 +66,7 @@ test(ENT_XML1, "SJIS");


?>
--EXPECT--
--EXPECTF--
*** Testing HTML 4.01/Windows-1251 ***
00000: 262378464646443b 262378464646443b
00001: 262378464646443b 262378464646443b
Expand Down Expand Up @@ -134,65 +132,177 @@ test(ENT_XML1, "SJIS");
000A0: a0 a0

*** Testing HTML 4.01/SJIS ***

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00000: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00001: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00009: 09 09

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000A: 0a 0a

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000B: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000C: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000D: 0d 0d

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000E: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0001F: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00020: 20 20

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0007F: 7f 7f

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00080: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0009F: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
000A0: INVALID SEQUENCE

*** Testing XHTML 1.0/SJIS ***

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00000: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00001: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00009: 09 09

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000A: 0a 0a

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000B: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000C: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000D: 0d 0d

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000E: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0001F: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00020: 20 20

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0007F: 7f 7f

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00080: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0009F: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
000A0: INVALID SEQUENCE

*** Testing HTML 5/SJIS ***

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00000: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00001: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00009: 09 09

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000A: 0a 0a

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000B: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000C: 0c 0c

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000D: 0d 0d

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000E: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0001F: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00020: 20 20

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0007F: 7f 7f

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00080: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0009F: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
000A0: INVALID SEQUENCE

*** Testing XML 1.0/SJIS ***

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00000: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00001: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00009: 09 09

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000A: 0a 0a

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000B: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000C: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000D: 0d 0d

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0000E: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0001F: 262378464646443b 262378464646443b

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00020: 20 20

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0007F: 7f 7f

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
00080: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
0009F: INVALID SEQUENCE

Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
000A0: INVALID SEQUENCE
Loading