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 (&#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.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&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 @@
 unicode(13) "abc&amp;sfdsa"
 unicode(33) "test&#043;s &amp; some more &#68;"
 unicode(33) "test&#043;s &amp; some more &#68;"
-unicode(24) "&; &amp;amp &amp;#a; &9;"
-unicode(24) "&; &amp;amp &amp;#a; &9;"
+unicode(34) "test&#x2b;s &amp; some more &#X44;"
+unicode(34) "test&#x2b;s &amp; some more &#X44;"
+unicode(35) "&; &amp;amp &amp;#a; &9; &amp;#xyz;"
+unicode(35) "&; &amp;amp &amp;#a; &9; &amp;#xyz;"
 unicode(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
 unicode(32) "&amp;kffjadfdhsjfhjasdhffasdfas;"
 unicode(16) "&amp;#8787978789"



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

Reply via email to