From: Moriyoshi Koizumi Date: Thu, 2 Oct 2003 19:23:00 +0000 (+0000) Subject: Fix for the fix for #25707 X-Git-Tag: BEFORE_HANDLERS_RESHUFFLE~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6745000c373658d0d1c5549a4456def404b1315f;p=php Fix for the fix for #25707 --- 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, "&", sizeof("&") - 1); + len += sizeof("&") - 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) {