summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-10-25 16:46:55 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-10-25 16:46:55 +0000
commit18fa045e75cc596d401017397402e578bc6f7ec0 (patch)
treed903b502c3969771f244170964160eaab1440b42
parent051145f62aaeaefe9f5df8dede8fc0ec45156387 (diff)
downloadphp-git-18fa045e75cc596d401017397402e578bc6f7ec0.tar.gz
Code cleanup & CS
-rw-r--r--ext/standard/html.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/standard/html.c b/ext/standard/html.c
index 8cf4fe45be..354e18bfec 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1307,9 +1307,11 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
}
}
- maxlen = 2 * oldlen;
- if (maxlen < 128)
- maxlen = 128;
+ if (oldlen < 64) {
+ maxlen = 128;
+ } else {
+ maxlen = 2 * oldlen;
+ }
replaced = emalloc(maxlen);
len = 0;
cursor = 0;
@@ -1322,8 +1324,9 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
/* guarantee we have at least 40 bytes to write.
* In HTML5, entities may take up to 33 bytes */
- if (len + 40 > maxlen)
+ if (len + 40 > maxlen) {
replaced = erealloc(replaced, maxlen += 128);
+ }
if (status == FAILURE) {
/* invalid MB sequence */
@@ -1335,9 +1338,6 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
continue;
} else {
efree(replaced);
- if(!PG(display_errors)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid multibyte sequence in argument");
- }
*newlen = 0;
return STR_EMPTY_ALLOC();
}