com php-src: Fixed ASSIGN_OBJ with IS_TMP and IS_ CONST operand: Zend/zend.c Zend/zend_execute.c

From: Date: Thu, 27 Feb 2014 18:53:56 +0000
Subject: com php-src: Fixed ASSIGN_OBJ with IS_TMP and IS_ CONST operand: Zend/zend.c Zend/zend_execute.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77860@lists.php.net to get a copy of this message
Commit: 5e4a97f36575c4f8562d541d4548461dd5483511 Author: Dmitry Stogov <dmitry@zend.com> Thu, 27 Feb 2014 22:53:56 +0400 Parents: 3f4759515ceb6b2175bf2ba2dee77b24b2e0e233 Branches: phpng Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5e4a97f36575c4f8562d541d4548461dd5483511 Log: Fixed ASSIGN_OBJ with IS_TMP and IS_CONST operand Changed paths: M Zend/zend.c M Zend/zend_execute.c Diff: diff --git a/Zend/zend.c b/Zend/zend.c index e8a6a40..dd03ea6 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -400,6 +400,9 @@ ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) /* {{{ */ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */ { + if (Z_ISREF_P(expr)) { + expr = Z_REFVAL_P(expr); + } switch (Z_TYPE_P(expr)) { case IS_ARRAY: ZEND_PUTS_EX("Array\n"); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 567d2f7..b65e044 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -746,6 +746,7 @@ static inline void zend_assign_to_object(zval *retval, zval *object, zval *prope { zend_free_op free_value; zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R); + zval tmp; if (Z_TYPE_P(object) != IS_OBJECT) { if (object == &EG(error_zval)) { @@ -788,24 +789,20 @@ static inline void zend_assign_to_object(zval *retval, zval *object, zval *prope } /* separate our value if necessary */ -//??? if (value_type == IS_TMP_VAR) { -//??? ALLOC_ZVAL(value); -//??? ZVAL_COPY_VALUE(value, orig_value); -//??? Z_UNSET_ISREF_P(value); -//??? Z_SET_REFCOUNT_P(value, 0); -//??? } else if (value_type == IS_CONST) { -//??? zval *orig_value = value; -//??? -//??? ALLOC_ZVAL(value); -//??? ZVAL_COPY_VALUE(value, orig_value); -//??? Z_UNSET_ISREF_P(value); -//??? Z_SET_REFCOUNT_P(value, 0); -//??? zval_copy_ctor(value); -//??? } - - if (Z_REFCOUNTED_P(value)) { + if (value_type == IS_TMP_VAR) { + if (UNEXPECTED(Z_ISREF_P(value))) { + ZVAL_COPY_VALUE(&tmp, Z_REFVAL_P(value)); + value = &tmp; + } + } else if (value_type == IS_CONST) { + if (UNEXPECTED(Z_ISREF_P(value))) { + value = Z_REFVAL_P(value); + } + ZVAL_DUP(&tmp, value); + } else if (Z_REFCOUNTED_P(value)) { Z_ADDREF_P(value); } + if (opcode == ZEND_ASSIGN_OBJ) { if (!Z_OBJ_HT_P(object)->write_property) { zend_error(E_WARNING, "Attempt to assign property of non-object");

« previous php.cvs (#77860) next »