]> granicus.if.org Git - php/commitdiff
Fixed support for IS_REFERENCE
authorDmitry Stogov <dmitry@zend.com>
Thu, 27 Feb 2014 20:21:12 +0000 (00:21 +0400)
committerDmitry Stogov <dmitry@zend.com>
Thu, 27 Feb 2014 20:21:12 +0000 (00:21 +0400)
Zend/zend_execute.c

index b65e04481149c363d37075aed1b6daee8623e23f..db12b38654db4681eee8ebd7e2da02672ebf307f 100644 (file)
@@ -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);