From: Stanislav Malyshev Date: Mon, 5 Jan 2004 11:45:46 +0000 (+0000) Subject: Bug #24608 - fix interaction between __accessors and get_property_ptr X-Git-Tag: php_ibase_before_split~390 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e11e7401c965e573e03eff151050e68953ed51a;p=php Bug #24608 - fix interaction between __accessors and get_property_ptr --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index f3acee7d1f..6b9ad7e771 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -169,7 +169,11 @@ static inline void zend_fetch_property_address_inner(zval *object, znode *op2, z } if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { - T(result->u.var).var.ptr_ptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, prop_ptr TSRMLS_CC); + zval **ptr_ptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, prop_ptr TSRMLS_CC); + if(NULL == ptr_ptr) { + zend_error(E_ERROR, "Cannot access undefined property for object with overloaded property access"); + } + T(result->u.var).var.ptr_ptr = ptr_ptr; } else if (Z_OBJ_HT_P(object)->read_property) { T(result->u.var).var.ptr = Z_OBJ_HT_P(object)->read_property(object, prop_ptr, 0 TSRMLS_CC); T(result->u.var).var.ptr_ptr = &T(result->u.var).var.ptr; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 01acba17a0..ded651952b 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -457,8 +457,8 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) { zval *new_zval; - if (!zobj->ce->__get) { - /* we don't have getter - will just add it */ + if (!zobj->ce->__get && !zobj->ce->__set) { + /* we don't have access controls - will just add it */ new_zval = &EG(uninitialized_zval); /* zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member)); */