Skip to content

Commit efc94f3

Browse files
committed
- Fixed bug #61374: html_entity_decode tries to decode code points that don't
exist in ISO-8859-1.
1 parent 7aefbf7 commit efc94f3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ext/standard/html.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,9 @@ static void traverse_for_entities(
10041004
/* && code2 == '\0' always true for current maps */)
10051005
goto invalid_code;
10061006

1007-
/* deal with encodings other than utf-8/iso-8859-1 */
1008-
if (!CHARSET_UNICODE_COMPAT(charset)) {
1007+
/* UTF-8 doesn't need mapping (ISO-8859-1 doesn't either, but
1008+
* the call is needed to ensure the codepoint <= U+00FF) */
1009+
if (charset != cs_utf_8) {
10091010
/* replace unicode code point */
10101011
if (map_from_unicode(code, charset, &code) == FAILURE || code2 != 0)
10111012
goto invalid_code; /* not representable in target charset */
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--TEST--
2+
Bug #61374: html_entity_decode tries to decode code points that don't exist in ISO-8859-1
3+
--FILE--
4+
<?php
5+
echo html_entity_decode('&OElig;', 0, 'ISO-8859-1');
6+
--EXPECT--
7+
&OElig;

0 commit comments

Comments
 (0)