lbarnaud Sun Aug 10 13:26:14 2008 UTC Modified files: (Branch: PHP_5_3) /php-src NEWS /php-src/ext/standard html.c /php-src/ext/standard/tests/strings htmlentities18.phpt Log: MFH: Fixed bug #45581 (htmlspecialchars() double encoding &#x hex items) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.259&r2=1.2027.2.547.2.965.2.260&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.259 php-src/NEWS:1.2027.2.547.2.965.2.260 --- php-src/NEWS:1.2027.2.547.2.965.2.259 Fri Aug 8 18:46:20 2008 +++ php-src/NEWS Sun Aug 10 13:26:13 2008 @@ -19,6 +19,7 @@ (Derick) - Fixed bug #45696 (Not all DateTime methods allow method chaining). (Derick) - Fixed bug #45636 (fileinfo ext duplicate strndup). (Derick) +- Fixed bug #45581 (htmlspecialchars() double encoding &#x hex items). (Arnaud) - Fixed bug #45545 (DateInterval has 4 char limitation for ISO durations). (Derick) - Fixed bug #44100 (Inconsistent handling of static array declarations with http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.14.2.9&r2=1.111.2.2.2.14.2.10&diff_format=u Index: php-src/ext/standard/html.c diff -u php-src/ext/standard/html.c:1.111.2.2.2.14.2.9 php-src/ext/standard/html.c:1.111.2.2.2.14.2.10 --- php-src/ext/standard/html.c:1.111.2.2.2.14.2.9 Fri Apr 11 19:06:12 2008 +++ php-src/ext/standard/html.c Sun Aug 10 13:26:13 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: html.c,v 1.111.2.2.2.14.2.9 2008/04/11 19:06:12 felipe Exp $ */ +/* $Id: html.c,v 1.111.2.2.2.14.2.10 2008/08/10 13:26:13 lbarnaud Exp $ */ /* * HTML entity resources: @@ -1194,9 +1194,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.1.2.2&r2=1.1.2.2.2.1&diff_format=u Index: php-src/ext/standard/tests/strings/htmlentities18.phpt diff -u php-src/ext/standard/tests/strings/htmlentities18.phpt:1.1.2.2 php-src/ext/standard/tests/strings/htmlentities18.phpt:1.1.2.2.2.1 --- php-src/ext/standard/tests/strings/htmlentities18.phpt:1.1.2.2 Sun May 27 15:57:11 2007 +++ php-src/ext/standard/tests/strings/htmlentities18.phpt Sun Aug 10 13:26:13 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 @@ string(13) "abc&sfdsa" string(33) "test+s & some more D" string(33) "test+s & some more D" -string(24) "&; &amp &#a; &9;" -string(24) "&; &amp &#a; &9;" +string(34) "test+s & some more D" +string(34) "test+s & some more D" +string(35) "&; &amp &#a; &9; &#xyz;" +string(35) "&; &amp &#a; &9; &#xyz;" string(32) "&kffjadfdhsjfhjasdhffasdfas;" string(32) "&kffjadfdhsjfhjasdhffasdfas;" string(16) "&#8787978789"
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php