lbarnaud Sun Aug 10 13:26:25 2008 UTC
Modified files: (Branch: PHP_5_2)
/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.1192&r2=1.2027.2.547.2.1193&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1192 php-src/NEWS:1.2027.2.547.2.1193
--- php-src/NEWS:1.2027.2.547.2.1192 Wed Aug 6 21:33:13 2008
+++ php-src/NEWS Sun Aug 10 13:26:24 2008
@@ -18,6 +18,7 @@
(Jani)
- Fixed bug #45691 (Some per-dir or runtime settings may leak into other
requests). (Moriyoshi)
+- Fixed bug #45581 (htmlspecialchars() double encoding &#x hex items). (Arnaud)
- Fixed bug #45568 (ISAPI doesn't properly clear auth_digest in header).
(Patch by: navara at emclient dot com)
- Fixed bug #45556 (Return value from callback isn't freed). (Felipe)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/html.c?r1=1.111.2.2.2.20&r2=1.111.2.2.2.21&diff_format=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.111.2.2.2.20
php-src/ext/standard/html.c:1.111.2.2.2.21
--- php-src/ext/standard/html.c:1.111.2.2.2.20 Fri Apr 11 19:01:25 2008
+++ php-src/ext/standard/html.c Sun Aug 10 13:26:25 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: html.c,v 1.111.2.2.2.20 2008/04/11 19:01:25 felipe Exp $ */
+/* $Id: html.c,v 1.111.2.2.2.21 2008/08/10 13:26:25 lbarnaud Exp $ */
/*
* HTML entity resources:
@@ -1199,9 +1199,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.3&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.3
--- 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:25 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