moriyoshi               Tue Jan 11 15:45:06 2005 EDT

  Added files:                 (Branch: PHP_5_0)
    /php-src/ext/standard/tests/strings htmlentities17.phpt 

  Modified files:              
    /php-src/ext/standard       html.c 
  Log:
  - MFH: fix htmlentities() / html_decode_entity() UTF-8 related bugs
    initially reported by Kamesh Jayachandran
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/html.c?r1=1.97.2.2&r2=1.97.2.3&ty=u
Index: php-src/ext/standard/html.c
diff -u php-src/ext/standard/html.c:1.97.2.2 
php-src/ext/standard/html.c:1.97.2.3
--- php-src/ext/standard/html.c:1.97.2.2        Sun Jan  9 16:05:16 2005
+++ php-src/ext/standard/html.c Tue Jan 11 15:45:06 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: html.c,v 1.97.2.2 2005/01/09 21:05:16 sniper Exp $ */
+/* $Id: html.c,v 1.97.2.3 2005/01/11 20:45:06 moriyoshi Exp $ */
 
 /*
  * HTML entity resources:
@@ -232,38 +232,37 @@
        NULL, NULL, "pr", "sc", "cupre", "sscue", "prsim", "scsim",
        /* 8832 (0x2280) */
        "npr", "nsc", "sub", "sup", "nsub", "nsup", "sube", "supe",
-       /* 8840 - 8852 */
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       /* 8853 */
-       "oplus", NULL, "otimes",
-       /* 8856 - 8868 */
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       /* 8869 */
-       "perp",
-       /* 8870 - 8901 */
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL,
-       /* 8901 */
-       "sdot",
-       /* 8902 - 8967 */
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL,
-       /* 8968 */
-       "lceil", "rceil", "lfloor", "rfloor",
-       /* 8969 - 9000 */
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-       NULL,
-       /* 9001 */
-       "lang", "rang",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8848 (0x2290) */
+       NULL, NULL, NULL, NULL, NULL, "oplus", NULL, "otimes",
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8864 (0x22a0) */
+       NULL, NULL, NULL, NULL, NULL, "perp", NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8880 (0x22b0) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8896 (0x22c0) */
+       NULL, NULL, NULL, NULL, NULL, "sdot", NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8912 (0x22d0) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8928 (0x22e0) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8944 (0x22f0) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8960 (0x2300) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       "lceil", "rceil", "lfloor", "rfloor", NULL, NULL, NULL, NULL,
+       /* 8976 (0x2310) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       /* 8992 (0x2320) */
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, "lang", "rang"
 };
 
 static entity_table_t ent_uni_9674[] = {
@@ -398,7 +397,7 @@
        { cs_8859_15,           0xa0, 0xff, ent_iso_8859_15 },
        { cs_utf_8,             0xa0, 0xff, ent_iso_8859_1 },
        { cs_utf_8,             338,  402,  ent_uni_338_402 },
-       { cs_utf_8,             710,  732,  ent_uni_spacing },
+       { cs_utf_8,             710,  731,  ent_uni_spacing },
        { cs_utf_8,             913,  982,  ent_uni_greek },
        { cs_utf_8,             8194, 8260, ent_uni_punct },
        { cs_utf_8,             8364, 8364, ent_uni_euro }, 

http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/htmlentities17.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/strings/htmlentities17.phpt
+++ php-src/ext/standard/tests/strings/htmlentities17.phpt
--TEST--
htmlentities() / html_entity_decode() #8592 - #9002 table test
--FILE--
<?php
$tests = array(
        array(8768, '&wreath;', "e28980"),
        array(8853, '&oplus;',  "e28a95"),
        array(8855, '&otimes;', "e28a97"),
        array(8869, '&perp;',   "e28aa5"),
        array(8901, '&sdot;',   "e28b85"),
        array(8968, '&lceil;',  "e28c88"),
        array(8969, '&rceil;',  "e28c89"),
        array(8970, '&lfloor;', "e28c8a"),
        array(8971, '&rfloor;', "e28c8b"),
        array(9001, '&lang;',   "e28ca9"),
        array(9002, '&rang;',   "e28caa")
);

foreach ($tests as $test) {
        var_dump(htmlentities(pack('H*', $test[2]), ENT_QUOTES, 'UTF-8'));
}

foreach ($tests as $test) {
        list(,$result) = unpack('H6', html_entity_decode($test[1], ENT_QUOTES, 
'UTF-8'));
        var_dump($result);
}
?>
--EXPECT--
string(8) "&wreath;"
string(7) "&oplus;"
string(8) "&otimes;"
string(6) "&perp;"
string(6) "&sdot;"
string(7) "&lceil;"
string(7) "&rceil;"
string(8) "&lfloor;"
string(8) "&rfloor;"
string(6) "&lang;"
string(6) "&rang;"
string(6) "e28980"
string(6) "e28a95"
string(6) "e28a97"
string(6) "e28aa5"
string(6) "e28b85"
string(6) "e28c88"
string(6) "e28c89"
string(6) "e28c8a"
string(6) "e28c8b"
string(6) "e28ca9"
string(6) "e28caa"

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

Reply via email to