com php-src: Fix ** operator with references: Zend/tests/pow_ ref.phpt Zend/zend_operators.c
| From: | Nikita Popov | Date: | Mon, 26 May 2014 16:17:55 +0000 |
| Subject: | com php-src: Fix ** operator with references: Zend/tests/pow_ ref.phpt Zend/zend_operators.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78548@lists.php.net to get a copy of this message | ||
Commit: 4ee14c6f8dd7324d9634d11a1f665cf6065e588a
Author: Nikita Popov <nikic@php.net> Mon, 26 May 2014 18:17:55 +0200
Parents: ff72c7bfd7b018c6b82ed6c97e1a8ac6ba6eebba
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4ee14c6f8dd7324d9634d11a1f665cf6065e588a
Log:
Fix ** operator with references
Changed paths:
A Zend/tests/pow_ref.phpt
M Zend/zend_operators.c
Diff:
diff --git a/Zend/tests/pow_ref.phpt b/Zend/tests/pow_ref.phpt
new file mode 100644
index 0000000..488e1d2
--- /dev/null
+++ b/Zend/tests/pow_ref.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Use power operator on reference
+--FILE--
+<?php
+
+$a = 2;
+$b = 3;
+
+$ref =& $b;
+
+$a **= $b;
+
+var_dump($a);
+
+?>
+--EXPECT--
+int(8)
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 163a493..72ac9fc 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) {