]> granicus.if.org Git - php/commitdiff
- Fixed a typo in rev #304208 (24 instead of 34/'"').
authorGustavo André dos Santos Lopes <cataphract@php.net>
Fri, 8 Oct 2010 17:27:19 +0000 (17:27 +0000)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Fri, 8 Oct 2010 17:27:19 +0000 (17:27 +0000)
- Improved the test bug53021.phpt to reflect other fixes in rev #304208.
- Updated NEWS to reflect other fixes in rev #304208.

NEWS
ext/standard/html.c
ext/standard/tests/strings/bug53021.phpt

diff --git a/NEWS b/NEWS
index fc8015e99392693447a8d2df2c7cf080d3cafe83..431e79c5b253ac4034afe8d3800e2d3169788bde 100644 (file)
--- a/NEWS
+++ b/NEWS
 - 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 &#34; 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).
index 79474216b602806f0a4eba32c2a090c905d77ad5..3edcaa6dacf7921717b3305db1c426911f406a48 100644 (file)
@@ -1020,8 +1020,8 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
                                                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;
                                        }
 
index 6f290096e4d5038489edfd5ff468d3fc3c68d077..4a8fbe4f760556b74adda41f952099e44fc8c74c 100644 (file)
@@ -3,8 +3,32 @@ Bug #53021 (Failure to convert numeric entities with ENT_NOQUOTES and ISO-8859-1
 --FILE--\r
 <?php\r
 var_dump(unpack("H*",html_entity_decode("&#233;", ENT_QUOTES, "ISO-8859-1")));\r
+echo "double quotes variations:", "\n";\r
+echo html_entity_decode("&quot;", ENT_NOQUOTES, 'UTF-8'), "\n";\r
+echo html_entity_decode("&#34;", ENT_NOQUOTES, 'UTF-8'), "\n";\r
+echo html_entity_decode("&quot;", ENT_QUOTES, 'UTF-8'), "\n";\r
+echo html_entity_decode("&#34;", ENT_QUOTES, 'UTF-8'), "\n";\r
+echo html_entity_decode("&quot;", ENT_COMPAT, 'UTF-8'), "\n";\r
+echo html_entity_decode("&#34;", ENT_COMPAT, 'UTF-8'), "\n";\r
+\r
+echo "\nsingle quotes variations:", "\n";\r
+echo html_entity_decode("&#39;", ENT_NOQUOTES, 'UTF-8'), "\n";\r
+echo html_entity_decode("&#39;", ENT_QUOTES, 'UTF-8'), "\n";\r
+echo html_entity_decode("&#39;", ENT_COMPAT, 'UTF-8'), "\n";\r
 --EXPECT--\r
 array(1) {\r
   [1]=>\r
   string(2) "e9"\r
 }\r
+double quotes variations:\r
+&quot;\r
+&#34;\r
+"\r
+"\r
+"\r
+"\r
+\r
+single quotes variations:\r
+&#39;\r
+'\r
+&#39;\r