From 08da14adaceb9b139b3314ed00ac3fd6a3ef2a09 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 28 Feb 2014 00:21:12 +0400 Subject: [PATCH] Fixed support for IS_REFERENCE --- Zend/zend_execute.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index b65e044811..db12b38654 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -742,12 +742,16 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva return 1; } -static inline void zend_assign_to_object(zval *retval, zval *object, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, const zend_literal *key TSRMLS_DC) +static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, const zend_literal *key TSRMLS_DC) { zend_free_op free_value; zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R); zval tmp; + zval *object = object_ptr; + if (Z_TYPE_P(object) == IS_REFERENCE) { + object = Z_REFVAL_P(object); + } if (Z_TYPE_P(object) != IS_OBJECT) { if (object == &EG(error_zval)) { if (retval) { @@ -760,7 +764,9 @@ static inline void zend_assign_to_object(zval *retval, zval *object, zval *prope (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) || (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) { if (Z_REFCOUNTED_P(object)) { - SEPARATE_ZVAL_IF_NOT_REF(object); + if (!Z_ISREF_P(object_ptr)) { + SEPARATE_ZVAL(object); + } Z_ADDREF_P(object); zend_error(E_WARNING, "Creating default object from empty value"); if (Z_REFCOUNT_P(object) == 1) { @@ -1400,8 +1406,14 @@ static void zend_fetch_dimension_address_read(zval *result, zval *container, zva } } -static void zend_fetch_property_address(zval *result, zval *container, zval *prop_ptr, const zend_literal *key, int type TSRMLS_DC) +static void zend_fetch_property_address(zval *result, zval *container_ptr, zval *prop_ptr, const zend_literal *key, int type TSRMLS_DC) { + zval *container = container_ptr; + + if (Z_TYPE_P(container) == IS_REFERENCE) { + container = Z_REFVAL_P(container); + } + if (Z_TYPE_P(container) != IS_OBJECT) { if (container == &EG(error_zval)) { ZVAL_INDIRECT(result, &EG(error_zval)); @@ -1413,7 +1425,7 @@ static void zend_fetch_property_address(zval *result, zval *container, zval *pro ((Z_TYPE_P(container) == IS_NULL || (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) || (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) { - if (!Z_ISREF_P(container)) { + if (!Z_ISREF_P(container_ptr)) { SEPARATE_ZVAL(container); } object_init(container); -- 2.40.0