cataphract Tue, 13 Mar 2012 18:08:30 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=324199
Log: - Fixed bug #61374: html_entity_decode tries to decode code points that don't exist in ISO-8859-1. Bug: https://bugs.php.net/61374 (Assigned) html_entity_decode tries to decode code points that don't exist in ISO-8859-1 Changed paths: U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/ext/standard/html.c A php/php-src/branches/PHP_5_4/ext/standard/tests/strings/bug61374.phpt U php/php-src/trunk/ext/standard/html.c A php/php-src/trunk/ext/standard/tests/strings/bug61374.phpt Modified: php/php-src/branches/PHP_5_4/NEWS =================================================================== --- php/php-src/branches/PHP_5_4/NEWS 2012-03-13 16:09:42 UTC (rev 324198) +++ php/php-src/branches/PHP_5_4/NEWS 2012-03-13 18:08:30 UTC (rev 324199) @@ -8,6 +8,8 @@ . "Connection: close" instead of "Connection: closed" (Gustavo) - Core: + . Fixed bug #61374 (html_entity_decode tries to decode code points that don't + exist in ISO-8859-1). (Gustavo) . Fixed bug #61273 (call_user_func_array with more than 16333 arguments leaks / crashes). (Laruence) . Fixed bug #61225 (Incorect lexing of 0b00*+<NUM>). (Pierrick) Modified: php/php-src/branches/PHP_5_4/ext/standard/html.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/standard/html.c 2012-03-13 16:09:42 UTC (rev 324198) +++ php/php-src/branches/PHP_5_4/ext/standard/html.c 2012-03-13 18:08:30 UTC (rev 324199) @@ -1004,8 +1004,9 @@ /* && code2 == '\0' always true for current maps */) goto invalid_code; - /* deal with encodings other than utf-8/iso-8859-1 */ - if (!CHARSET_UNICODE_COMPAT(charset)) { + /* UTF-8 doesn't need mapping (ISO-8859-1 doesn't either, but + * the call is needed to ensure the codepoint <= U+00FF) */ + if (charset != cs_utf_8) { /* replace unicode code point */ if (map_from_unicode(code, charset, &code) == FAILURE || code2 != 0) goto invalid_code; /* not representable in target charset */ Added: php/php-src/branches/PHP_5_4/ext/standard/tests/strings/bug61374.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/standard/tests/strings/bug61374.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/ext/standard/tests/strings/bug61374.phpt 2012-03-13 18:08:30 UTC (rev 324199) @@ -0,0 +1,7 @@ +--TEST-- +Bug #61374: html_entity_decode tries to decode code points that don't exist in ISO-8859-1 +--FILE-- +<?php +echo html_entity_decode('Œ', 0, 'ISO-8859-1'); +--EXPECT-- +Œ Property changes on: php/php-src/branches/PHP_5_4/ext/standard/tests/strings/bug61374.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Modified: php/php-src/trunk/ext/standard/html.c =================================================================== --- php/php-src/trunk/ext/standard/html.c 2012-03-13 16:09:42 UTC (rev 324198) +++ php/php-src/trunk/ext/standard/html.c 2012-03-13 18:08:30 UTC (rev 324199) @@ -1004,8 +1004,9 @@ /* && code2 == '\0' always true for current maps */) goto invalid_code; - /* deal with encodings other than utf-8/iso-8859-1 */ - if (!CHARSET_UNICODE_COMPAT(charset)) { + /* UTF-8 doesn't need mapping (ISO-8859-1 doesn't either, but + * the call is needed to ensure the codepoint <= U+00FF) */ + if (charset != cs_utf_8) { /* replace unicode code point */ if (map_from_unicode(code, charset, &code) == FAILURE || code2 != 0) goto invalid_code; /* not representable in target charset */ Added: php/php-src/trunk/ext/standard/tests/strings/bug61374.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/strings/bug61374.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/strings/bug61374.phpt 2012-03-13 18:08:30 UTC (rev 324199) @@ -0,0 +1,7 @@ +--TEST-- +Bug #61374: html_entity_decode tries to decode code points that don't exist in ISO-8859-1 +--FILE-- +<?php +echo html_entity_decode('Œ', 0, 'ISO-8859-1'); +--EXPECT-- +Œ Property changes on: php/php-src/trunk/ext/standard/tests/strings/bug61374.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php