lbarnaud Sun Aug 10 13:25:53 2008 UTC Modified files: /php-src/ext/standard html.c /php-src/ext/standard/tests/strings htmlentities18.phpt Log: Fixed bug #45581 (htmlspecialchars() double encoding &#x hex items) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.133&r2=1.134&diff_format=u Index: php-src/ext/standard/html.c diff -u php-src/ext/standard/html.c:1.133 php-src/ext/standard/html.c:1.134 --- php-src/ext/standard/html.c:1.133 Fri Apr 11 19:08:04 2008 +++ php-src/ext/standard/html.c Sun Aug 10 13:25:52 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: html.c,v 1.133 2008/04/11 19:08:04 felipe Exp $ */ +/* $Id: html.c,v 1.134 2008/08/10 13:25:52 lbarnaud Exp $ */ /* * HTML entity resources: @@ -1197,9 +1197,20 @@ } else { if (*s == '#') { /* numeric entities */ s++; - while (s < e) { - if (!isdigit(*s++)) { - goto encode_amp; + /* Hex (Z) */ + if (*s == 'x' || *s == 'X') { + s++; + while (s < e) { + if (!isxdigit(*s++)) { + goto encode_amp; + } + } + /* Dec (Z)*/ + } else { + while (s < e) { + if (!isdigit(*s++)) { + goto encode_amp; + } } } } else { /* text entities */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/htmlentities18.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/standard/tests/strings/htmlentities18.phpt diff -u php-src/ext/standard/tests/strings/htmlentities18.phpt:1.3 php-src/ext/standard/tests/strings/htmlentities18.phpt:1.4 --- php-src/ext/standard/tests/strings/htmlentities18.phpt:1.3 Fri Jun 13 00:18:57 2008 +++ php-src/ext/standard/tests/strings/htmlentities18.phpt Sun Aug 10 13:25:53 2008 @@ -6,7 +6,8 @@ "abc", "abc&sfdsa", "test+s & some more D", - "&; & &#a; &9;", + "test+s & some more D", + "&; & &#a; &9; &#xyz;", "&kffjadfdhsjfhjasdhffasdfas;", "�", "&", @@ -26,8 +27,10 @@ unicode(13) "abc&sfdsa" unicode(33) "test+s & some more D" unicode(33) "test+s & some more D" -unicode(24) "&; &amp &#a; &9;" -unicode(24) "&; &amp &#a; &9;" +unicode(34) "test+s & some more D" +unicode(34) "test+s & some more D" +unicode(35) "&; &amp &#a; &9; &#xyz;" +unicode(35) "&; &amp &#a; &9; &#xyz;" unicode(32) "&kffjadfdhsjfhjasdhffasdfas;" unicode(32) "&kffjadfdhsjfhjasdhffasdfas;" unicode(16) "&#8787978789"
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php