From: Andi Gutmans Date: Sun, 26 Aug 2001 15:16:06 +0000 (+0000) Subject: - MFZE1 X-Git-Tag: PRE_SUBST_Z_MACROS~346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0970f14216e37b5756faf3d2e177f0e157c6839;p=php - MFZE1 --- diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index a37fcc9066..8056cfe559 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1014,7 +1014,11 @@ ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) { int length = op1->value.str.len + op2->value.str.len; - result->value.str.val = (char *) erealloc(op1->value.str.val, length+1); + if (op1->value.str.val == empty_string) { + result->value.str.val = (char *) emalloc(length+1); + } else { + result->value.str.val = (char *) erealloc(op1->value.str.val, length+1); + } memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); result->value.str.val[length] = 0; result->value.str.len = length;