From: Nikita Popov Date: Mon, 26 May 2014 16:17:55 +0000 (+0200) Subject: Fix ** operator with references X-Git-Tag: POST_PHPNG_MERGE~277 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ee14c6f8dd7324d9634d11a1f665cf6065e588a;p=php Fix ** operator with references --- diff --git a/Zend/tests/pow_ref.phpt b/Zend/tests/pow_ref.phpt new file mode 100644 index 0000000000..488e1d2d89 --- /dev/null +++ b/Zend/tests/pow_ref.phpt @@ -0,0 +1,17 @@ +--TEST-- +Use power operator on reference +--FILE-- + +--EXPECT-- +int(8) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 163a493060..72ac9fca1f 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1137,7 +1137,11 @@ ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * return SUCCESS; default: - if (!converted) { + if (Z_ISREF_P(op1)) { + op1 = Z_REFVAL_P(op1); + } else if (Z_ISREF_P(op2)) { + op2 = Z_REFVAL_P(op2); + } else if (!converted) { ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW); if (Z_TYPE_P(op1) == IS_ARRAY) {