Skip to content
Open
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
4 changes: 4 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ PHP 8.7 UPGRADE NOTES
========================================

- Standard:
. The default $flags of htmlspecialchars_decode() and html_entity_decode()
is now ENT_QUOTES | ENT_HTML401. ENT_SUBSTITUTE was removed from the
default because the decoding functions ignore it. The behavior does not
change.
. stream_select() no longer fails once a watched descriptor exceeds
FD_SETSIZE. The descriptor set now grows on demand on both POSIX (bitset)
and Windows (winsock fd_set), so code watching many streams works without
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2275,9 +2275,9 @@ function headers_list(): array {}

function htmlspecialchars(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null, bool $double_encode = true): string {}

function htmlspecialchars_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401): string {}
function htmlspecialchars_decode(string $string, int $flags = ENT_QUOTES | ENT_HTML401): string {}

function html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null): string {}
function html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_HTML401, ?string $encoding = null): string {}

function htmlentities(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ?string $encoding = null, bool $double_encode = true): string {}

Expand Down
6 changes: 3 additions & 3 deletions ext/standard/basic_functions_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ext/standard/basic_functions_decl.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/standard/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ PHP_FUNCTION(htmlspecialchars)
PHP_FUNCTION(htmlspecialchars_decode)
{
zend_string *str;
zend_long quote_style = ENT_QUOTES|ENT_SUBSTITUTE;
zend_long quote_style = ENT_QUOTES;
zend_string *replaced;

ZEND_PARSE_PARAMETERS_START(1, 2)
Expand All @@ -1626,7 +1626,7 @@ PHP_FUNCTION(htmlspecialchars_decode)
PHP_FUNCTION(html_entity_decode)
{
zend_string *str, *hint_charset = NULL;
zend_long quote_style = ENT_QUOTES|ENT_SUBSTITUTE;
zend_long quote_style = ENT_QUOTES;
zend_string *replaced;

ZEND_PARSE_PARAMETERS_START(1, 3)
Expand Down
16 changes: 16 additions & 0 deletions ext/standard/tests/strings/gh9582.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
GH-9582 (htmlspecialchars_decode() ENT_SUBSTITUTE flag has no effect)
--FILE--
<?php
echo (new ReflectionFunction(htmlspecialchars_decode(...)))->getParameters()[1], "\n";
echo (new ReflectionFunction(html_entity_decode(...)))->getParameters()[1], "\n";

$invalid = "\xC3&amp;&quot;&#039;";
var_dump(htmlspecialchars_decode($invalid) === htmlspecialchars_decode($invalid, ENT_QUOTES | ENT_SUBSTITUTE));
var_dump(html_entity_decode($invalid) === html_entity_decode($invalid, ENT_QUOTES | ENT_SUBSTITUTE));
?>
--EXPECT--
Parameter #1 [ <optional> int $flags = ENT_QUOTES | ENT_HTML401 ]
Parameter #1 [ <optional> int $flags = ENT_QUOTES | ENT_HTML401 ]
bool(true)
bool(true)
Loading