summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2001-08-26 15:16:06 +0000
committerAndi Gutmans <andi@php.net>2001-08-26 15:16:06 +0000
commitb0970f14216e37b5756faf3d2e177f0e157c6839 (patch)
treec03c761a2cfa3c334d77c12089296222cd83757a /Zend/zend_operators.c
parente2efa0196f16dfcd8de623aae6919399ff06f3b8 (diff)
downloadphp-git-b0970f14216e37b5756faf3d2e177f0e157c6839.tar.gz
- MFZE1
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c6
1 files changed, 5 insertions, 1 deletions
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;