diff options
author | Dmitry Stogov <dmitry@php.net> | 2006-07-21 10:32:17 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2006-07-21 10:32:17 +0000 |
commit | 33a1a4d39ae3c64675ec21957ed9b198b2eea1b9 (patch) | |
tree | 68fc4be760c94da097872173fe395bb5c2886357 /Zend/zend_object_handlers.c | |
parent | 9a98904ddd0e08629afb9cc74299a28a5ff86cec (diff) | |
download | php-git-33a1a4d39ae3c64675ec21957ed9b198b2eea1b9.tar.gz |
Changed error message (E_ERROR -> E_NOTICE) in case of indirect modification of overloaded property.
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r-- | Zend/zend_object_handlers.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index d3a52064fe..6b4e00edb3 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -334,6 +334,18 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) if (rv) { retval = &rv; + if ((type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) && rv->refcount > 0) { + zval *tmp = rv; + + ALLOC_ZVAL(rv); + *rv = *tmp; + zval_copy_ctor(rv); + rv->is_ref = 0; + rv->refcount = 0; + if (Z_TYPE_P(rv) != IS_OBJECT) { + zend_error(E_NOTICE, "Indirect modification of overloaded property %s::$%s has no effect", zobj->ce->name, Z_STRVAL_P(member)); + } + } } else { retval = &EG(uninitialized_zval_ptr); } @@ -349,9 +361,9 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) zval_ptr_dtor(&tmp_member); (*retval)->refcount--; } - if (*retval && (type == BP_VAR_W || type == BP_VAR_RW) && Z_TYPE_PP(retval) == IS_ARRAY) { - zend_error(E_ERROR, "Cannot use array returned from %s::__get('%s') in write context", zobj->ce->name, Z_STRVAL_P(member)); - } +// if (*retval && (type == BP_VAR_W || type == BP_VAR_RW) && Z_TYPE_PP(retval) == IS_ARRAY) { +// zend_error(E_ERROR, "Cannot use array returned from %s::__get('%s') in write context", zobj->ce->name, Z_STRVAL_P(member)); +// } return *retval; } |