]> granicus.if.org Git - php/commitdiff
Fixed memory leak in pow operator
authorBob Weinand <bobwei9@hotmail.com>
Thu, 6 Feb 2014 20:31:40 +0000 (21:31 +0100)
committerBob Weinand <bobwei9@hotmail.com>
Thu, 6 Feb 2014 20:31:40 +0000 (21:31 +0100)
Zend/zend_operators.c
ext/standard/tests/math/pow_variation2.phpt

index 03dbb152641b06cceb7b80f8506d43dd14685df8..f022909bc396a305b417a06116e5c956226381e5 100644 (file)
@@ -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);
                                        }
index b1800bb15f4a5fe8b4e652485f5705fa9e94f2de..f571936727a808df24cdfea051166591aaa21066 100644 (file)
@@ -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===