summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-10-17 10:26:07 +0000
committerDmitry Stogov <dmitry@php.net>2008-10-17 10:26:07 +0000
commit41ad9b4d1fdd8790aaabbbbd4e37e61adc93421a (patch)
treeef8791447ff56b7bfe24c8ab89ea5aad246ee6ef /Zend/zend_object_handlers.c
parente52fc53bc253f1e10ac8d424a3b4fa50ac0555ce (diff)
downloadphp-git-41ad9b4d1fdd8790aaabbbbd4e37e61adc93421a.tar.gz
Fixed bug #46308 (Invalid write when changing property from inside getter)
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r--Zend/zend_object_handlers.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 49dbf5ceb1..57839ff50c 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -345,6 +345,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) /*
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_get) {
/* have getter - try with it! */
+ Z_ADDREF_P(object);
guard->in_get = 1; /* prevent circular getting */
rv = zend_std_call_getter(object, member TSRMLS_CC);
guard->in_get = 0;
@@ -369,6 +370,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC) /*
} else {
retval = &EG(uninitialized_zval_ptr);
}
+ zval_ptr_dtor(&object);
} else {
if (!silent) {
zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name, Z_STRVAL_P(member));
@@ -439,12 +441,14 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
if (zobj->ce->__set &&
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_set) {
+ Z_ADDREF_P(object);
guard->in_set = 1; /* prevent circular setting */
if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) {
/* for now, just ignore it - __set should take care of warnings, etc. */
}
setter_done = 1;
guard->in_set = 0;
+ zval_ptr_dtor(&object);
}
if (!setter_done && property_info) {
zval **foo;
@@ -620,9 +624,11 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_unset) {
/* have unseter - try with it! */
+ Z_ADDREF_P(object);
guard->in_unset = 1; /* prevent circular unsetting */
zend_std_call_unsetter(object, member TSRMLS_CC);
guard->in_unset = 0;
+ zval_ptr_dtor(&object);
}
}
@@ -1117,6 +1123,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists
zval *rv;
/* have issetter - try with it! */
+ Z_ADDREF_P(object);
guard->in_isset = 1; /* prevent circular getting */
rv = zend_std_call_issetter(object, member TSRMLS_CC);
if (rv) {
@@ -1140,6 +1147,7 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists
}
}
guard->in_isset = 0;
+ zval_ptr_dtor(&object);
}
} else {
switch (has_set_exists) {