summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2004-07-19 17:46:30 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2004-07-19 17:46:30 +0000
commit46bc2c5ae2ae742409f2b8bbf76f44dcd209d127 (patch)
treef782a89b36f04da64cb677a9dc110d3feb8b9eec /ext
parentd84702836a2d43891d001b3ba424c32f222faeef (diff)
downloadphp-git-46bc2c5ae2ae742409f2b8bbf76f44dcd209d127.tar.gz
- Fix bug #29199 (html_entity_decode() misbehaves with UTF-8)
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/html.c11
-rw-r--r--ext/standard/tests/strings/bug29199.phpt8
2 files changed, 14 insertions, 5 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 4f8a4be46b..e3a38c3d15 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -157,11 +157,13 @@ static entity_table_t ent_uni_punct[] = {
"ensp", "emsp", NULL, NULL, NULL, NULL, NULL,
"thinsp", NULL, NULL, "zwnj", "zwj", "lrm", "rlm",
NULL, NULL, NULL, "ndash", "mdash", NULL, NULL, NULL,
- "lsquo", "rsquo", "sbquo", NULL, "ldquo", "rdquo", "bdquo",
+ /* 8216 */
+ "lsquo", "rsquo", "sbquo", NULL, "ldquo", "rdquo", "bdquo", NULL,
"dagger", "Dagger", "bull", NULL, NULL, NULL, "hellip",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "permil", NULL,
- "prime", "Prime", NULL, NULL, NULL, NULL, NULL, "lsaquo", "rsaquo",
- NULL, NULL, NULL, "oline", NULL, NULL, NULL, NULL, NULL,
+ /* 8242 */
+ "prime", "Prime", NULL, NULL, NULL, NULL, NULL, "lsaquo", "rsaquo", NULL,
+ NULL, NULL, "oline", NULL, NULL, NULL, NULL, NULL,
"frasl"
};
@@ -899,8 +901,7 @@ PHPAPI char *php_unescape_html_entities(unsigned char *old, int oldlen, int *new
if (entity_map[j].table[k - entity_map[j].basechar] == NULL)
continue;
-
-
+
entity[0] = '&';
entity_length = strlen(entity_map[j].table[k - entity_map[j].basechar]);
strncpy(&entity[1], entity_map[j].table[k - entity_map[j].basechar], sizeof(entity) - 2);
diff --git a/ext/standard/tests/strings/bug29199.phpt b/ext/standard/tests/strings/bug29199.phpt
new file mode 100644
index 0000000000..bb2707fe07
--- /dev/null
+++ b/ext/standard/tests/strings/bug29199.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #29199 (html_entity_decode() misbehaves with UTF-8)
+--FILE--
+<?php
+var_dump(bin2hex(html_entity_decode('&ensp;&thinsp;&lsquo;&dagger;&prime;&frasl;&euro;', ENT_QUOTES, 'UTF-8')));
+?>
+--EXPECT--
+string(42) "e28082e28089e28098e280a0e280b2e28184e282ac"