com php-src: Fix incdec of ref object properties: Zend/zend_o perators.c
| From: | Nikita Popov | Date: | Mon, 26 May 2014 16:00:15 +0000 |
| Subject: | com php-src: Fix incdec of ref object properties: Zend/zend_o perators.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78546@lists.php.net to get a copy of this message | ||
Commit: ec7b5e0b19915a3ace184d519784f33afc64b9d8
Author: Nikita Popov <nikic@php.net> Mon, 26 May 2014 17:58:10 +0200
Parents: 40256e0f9c76b7233e264b8a6e8430feee2c551c
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec7b5e0b19915a3ace184d519784f33afc64b9d8
Log:
Fix incdec of ref object properties
This fixes a number of infinite loops in the Symfony testsuite. It
took an obscene amount of time to track this down :/
Changed paths:
M Zend/zend_operators.c
Diff:
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 2ab70e8..163a493 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -2086,6 +2086,7 @@ static void increment_string(zval *str) /* {{{ */
ZEND_API int increment_function(zval *op1) /* {{{ */
{
+try_again:
switch (Z_TYPE_P(op1)) {
case IS_LONG:
if (Z_LVAL_P(op1) == LONG_MAX) {
@@ -2141,6 +2142,9 @@ ZEND_API int increment_function(zval *op1) /* {{{ */
return res;
}
return FAILURE;
+ case IS_REFERENCE:
+ op1 = Z_REFVAL_P(op1);
+ goto try_again;
default:
return FAILURE;
}
@@ -2153,6 +2157,7 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */
long lval;
double dval;
+try_again:
switch (Z_TYPE_P(op1)) {
case IS_LONG:
if (Z_LVAL_P(op1) == LONG_MIN) {
@@ -2200,6 +2205,9 @@ ZEND_API int decrement_function(zval *op1) /* {{{ */
return res;
}
return FAILURE;
+ case IS_REFERENCE:
+ op1 = Z_REFVAL_P(op1);
+ goto try_again;
default:
return FAILURE;
}