return 0;
}
- replaced = php_str_to_str(ret, retlen, entity, entity_length, replacement, replacement_len, &retlen);
- efree(ret);
- ret = replaced;
+ if (php_memnstr(ret, entity, entity_length, ret+retlen)) {
+ replaced = php_str_to_str(ret, retlen, entity, entity_length, replacement, replacement_len, &retlen);
+ efree(ret);
+ ret = replaced;
+ }
}
}
}
replacement[0] = (unsigned char)basic_entities[j].charcode;
replacement[1] = '\0';
-
- replaced = php_str_to_str(ret, retlen, basic_entities[j].entity, basic_entities[j].entitylen, replacement, 1, &retlen);
- efree(ret);
- ret = replaced;
+
+ if (php_memnstr(ret, basic_entities[j].entity, basic_entities[j].entitylen, ret+retlen)) {
+ replaced = php_str_to_str(ret, retlen, basic_entities[j].entity, basic_entities[j].entitylen, replacement, 1, &retlen);
+ efree(ret);
+ ret = replaced;
+ }
}
/* replace numeric entities & "&" */