summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-10-02 19:23:00 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-10-02 19:23:00 +0000
commit6745000c373658d0d1c5549a4456def404b1315f (patch)
treef6b4cce2147a3ba8990f260eb507443d95ed7d95
parent04bcd89277182e6e38aa95a02e0b5463a44d92ca (diff)
downloadphp-git-6745000c373658d0d1c5549a4456def404b1315f.tar.gz
Fix for the fix for #25707
-rw-r--r--ext/standard/html.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c
index da93456abc..26ae951f2e 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1076,18 +1076,26 @@ PHPAPI char *php_escape_html_entities(unsigned char *old, int oldlen, int *newle
if (!matches_map) {
int is_basic = 0;
- for (j = 0; basic_entities[j].charcode != 0; j++) {
- if ((basic_entities[j].charcode != this_char) ||
- (basic_entities[j].flags && (quote_style & basic_entities[j].flags) == 0))
- continue;
-
- memcpy(replaced + len, basic_entities[j].entity, basic_entities[j].entitylen);
- len += basic_entities[j].entitylen;
-
+ if (this_char == '&') {
+ memcpy(replaced + len, "&amp;", sizeof("&amp;") - 1);
+ len += sizeof("&amp;") - 1;
is_basic = 1;
- break;
+ } else {
+ for (j = 0; basic_entities[j].charcode != 0; j++) {
+ if ((basic_entities[j].charcode != this_char) ||
+ (basic_entities[j].flags &&
+ (quote_style & basic_entities[j].flags) == 0)) {
+ continue;
+ }
+ memcpy(replaced + len, basic_entities[j].entity, basic_entities[j].entitylen);
+ len += basic_entities[j].entitylen;
+
+ is_basic = 1;
+ break;
+ }
}
+
if (!is_basic) {
/* a wide char without a named entity; pass through the original sequence */
if (mbseqlen > 1) {