cataphract                               Fri, 08 Oct 2010 17:27:19 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=304209

Log:
- Fixed a typo in rev #304208 (24 instead of 34/'"').
- Improved the test bug53021.phpt to reflect other fixes in rev #304208.
- Updated NEWS to reflect other fixes in rev #304208.

Bugs: http://bugs.php.net/304208 (error getting bug information)
      http://bugs.php.net/53021 (Closed) html_entity_decode not working with 
CP-1251 (5.2 only) and ISO-8859-1
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/standard/html.c
    U   php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53021.phpt
    U   php/php-src/trunk/ext/standard/html.c
    U   php/php-src/trunk/ext/standard/tests/strings/bug53021.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-10-08 16:19:58 UTC (rev 304208)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-10-08 17:27:19 UTC (rev 304209)
@@ -26,7 +26,10 @@
 - Fixed inconsistent backlog default value (-1) in FPM on many systems. (fat)

 - Fixed bug #53021 (In html_entity_decode, failure to convert numeric entities
-  with ENT_NOQUOTES and ISO-8859-1) (Gustavo).
+  with ENT_NOQUOTES and ISO-8859-1). Fixed and extended the fix of ENT_NOQUOTES
+  in html_entity_decode that had introduced the bug (rev #185591) to other
+  encodings. Additionaly, html_entity_decode() now doesn't decode " if
+  ENT_NOQUOTES is given. (Gustavo)
 - Fixed bug #52981 (Unicode casing table was out-of-date. Updated with
   UnicodeData-6.0.0d7.txt and included the source of the generator program with
   the distribution) (Gustavo).

Modified: php/php-src/branches/PHP_5_3/ext/standard/html.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/html.c    2010-10-08 16:19:58 UTC 
(rev 304208)
+++ php/php-src/branches/PHP_5_3/ext/standard/html.c    2010-10-08 17:27:19 UTC 
(rev 304209)
@@ -1020,8 +1020,8 @@
                                                code = strtol(p + 2, &next, 10);
                                        }

-                                       if (code == 39 && !(quote_style & 
ENT_HTML_QUOTE_SINGLE) ||
-                                               code == 24 && !(quote_style & 
ENT_HTML_QUOTE_DOUBLE)) {
+                                       if (code == '\'' && !(quote_style & 
ENT_HTML_QUOTE_SINGLE) ||
+                                               code == '"' && !(quote_style & 
ENT_HTML_QUOTE_DOUBLE)) {
                                                invalid_code = 1;
                                        }


Modified: php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53021.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53021.phpt       
2010-10-08 16:19:58 UTC (rev 304208)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug53021.phpt       
2010-10-08 17:27:19 UTC (rev 304209)
@@ -3,8 +3,32 @@
 --FILE--
 <?php
 var_dump(unpack("H*",html_entity_decode("&#233;", ENT_QUOTES, "ISO-8859-1")));
+echo "double quotes variations:", "\n";
+echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";
+
+echo "\nsingle quotes variations:", "\n";
+echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";
 --EXPECT--
 array(1) {
   [1]=>
   string(2) "e9"
 }
+double quotes variations:
+&quot;
+&#34;
+"
+"
+"
+"
+
+single quotes variations:
+&#39;
+'
+&#39;

Modified: php/php-src/trunk/ext/standard/html.c
===================================================================
--- php/php-src/trunk/ext/standard/html.c       2010-10-08 16:19:58 UTC (rev 
304208)
+++ php/php-src/trunk/ext/standard/html.c       2010-10-08 17:27:19 UTC (rev 
304209)
@@ -1020,8 +1020,8 @@
                                                code = strtol(p + 2, &next, 10);
                                        }

-                                       if (code == 39 && !(quote_style & 
ENT_HTML_QUOTE_SINGLE) ||
-                                               code == 24 && !(quote_style & 
ENT_HTML_QUOTE_DOUBLE)) {
+                                       if (code == '\'' && !(quote_style & 
ENT_HTML_QUOTE_SINGLE) ||
+                                               code == '"' && !(quote_style & 
ENT_HTML_QUOTE_DOUBLE)) {
                                                invalid_code = 1;
                                        }


Modified: php/php-src/trunk/ext/standard/tests/strings/bug53021.phpt
===================================================================
--- php/php-src/trunk/ext/standard/tests/strings/bug53021.phpt  2010-10-08 
16:19:58 UTC (rev 304208)
+++ php/php-src/trunk/ext/standard/tests/strings/bug53021.phpt  2010-10-08 
17:27:19 UTC (rev 304209)
@@ -3,8 +3,32 @@
 --FILE--
 <?php
 var_dump(unpack("H*",html_entity_decode("&#233;", ENT_QUOTES, "ISO-8859-1")));
+echo "double quotes variations:", "\n";
+echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";
+echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";
+
+echo "\nsingle quotes variations:", "\n";
+echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";
+echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";
 --EXPECT--
 array(1) {
   [1]=>
   string(2) "e9"
 }
+double quotes variations:
+&quot;
+&#34;
+"
+"
+"
+"
+
+single quotes variations:
+&#39;
+'
+&#39;

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

Reply via email to