From ec7b5e0b19915a3ace184d519784f33afc64b9d8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 26 May 2014 17:58:10 +0200 Subject: [PATCH] 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 :/ --- Zend/zend_operators.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 2ab70e8fa1..163a493060 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; } -- 2.50.1