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 (&#x5A;) */
+                                                       if (*s == 'x' || *s == 
'X') {
+                                                               s++;
+                                                               while (s < e) {
+                                                                       if 
(!isxdigit(*s++)) {
+                                                                               
goto encode_amp;
+                                                                       }
+                                                               }
+                                                       /* Dec (&#90;)*/
+                                                       } 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&amp;sfdsa",
        "test&#043;s &amp; some more &#68;",
-       "&; &amp &#a; &9;",
+       "test&#x2b;s &amp; some more &#X44;",
+       "&; &amp &#a; &9; &#xyz;",
        "&kffjadfdhsjfhjasdhffasdfas;",
        "&#8787978789",
        "&",
@@ -26,8 +27,10 @@
 string(13) "abc&amp;sfdsa"
 string(33) "test&#043;s &amp; some more &#68;"
 string(33) "test&#043;s &amp; some more &#68;"
-string(24) "&; &amp;amp &amp;#a; &9;"
-string(24) "&; &amp;amp &amp;#a; &9;"
+string(34) "test&#x2b;s &amp; some more &#X44;"
+string(34) "test&#x2b;s &amp; some more &#X44;"
+string(35) "&; &amp;amp &amp;#a; &9; &amp;#xyz;"
+string(35) "&; &amp;amp &amp;#a; &9; &amp;#xyz;"
 string(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
 string(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
 string(16) "&amp;#8787978789"



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to