From: Bob Weinand Date: Thu, 6 Feb 2014 20:31:40 +0000 (+0100) Subject: Fixed memory leak in pow operator X-Git-Tag: php-5.6.0alpha2~1^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=363ff60475d93716722034b8f7a2486229bf4cfb;p=php Fixed memory leak in pow operator --- diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 03dbb15264..f022909bc3 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1026,12 +1026,14 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW); if (Z_TYPE_P(op1) == IS_ARRAY) { - ZVAL_LONG(op1, 0); + ZVAL_LONG(result, 0); + return SUCCESS; } else { zendi_convert_scalar_to_number(op1, op1_copy, result); } if (Z_TYPE_P(op2) == IS_ARRAY) { - ZVAL_LONG(op2, 0); + ZVAL_LONG(result, 1L); + return SUCCESS; } else { zendi_convert_scalar_to_number(op2, op2_copy, result); } diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt index b1800bb15f..f571936727 100644 --- a/ext/standard/tests/math/pow_variation2.phpt +++ b/ext/standard/tests/math/pow_variation2.phpt @@ -145,7 +145,7 @@ float(1) float(1) -- Iteration 19 -- -float(1) +int(1) -- Iteration 20 -- float(1) @@ -169,4 +169,4 @@ float(1) -- Iteration 26 -- %s -===Done=== \ No newline at end of file +===Done===