summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-10-17 15:01:54 +0400
committerDmitry Stogov <dmitry@zend.com>2014-10-17 15:01:54 +0400
commitf2fa7a41cfc9854e74148e6f6330181f42372371 (patch)
tree19e1dae3de601c622b8b1565be217875f6eb79f5 /Zend
parent6b203aa26243a46775483a1318427b081095c126 (diff)
downloadphp-git-f2fa7a41cfc9854e74148e6f6330181f42372371.tar.gz
Don't make difference between undefined and unaccessible properies when call __get() and family
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_object_handlers.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index d143b00663..ba089674c1 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -423,41 +423,19 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
}
/* }}} */
-static zend_long *zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member) /* {{{ */
+static zend_long *zend_get_property_guard(zend_object *zobj, zval *member) /* {{{ */
{
- zend_property_info info;
zval stub, *guard;
- zend_string *str = NULL;
- if (!property_info) {
- property_info = &info;
- info.name = Z_STR_P(member);
- } else if(property_info->name->val[0] == '\0'){
- const char *class_name = NULL, *prop_name = NULL;
- size_t prop_name_len;
- zend_unmangle_property_name_ex(property_info->name, &class_name,
- &prop_name, &prop_name_len);
- if (class_name) {
- /* use unmangled name for protected properties */
- str = info.name = zend_string_init(prop_name, prop_name_len, 0);
- property_info = &info;
- }
- }
if (!zobj->guards) {
ALLOC_HASHTABLE(zobj->guards);
zend_hash_init(zobj->guards, 8, NULL, NULL, 0);
- } else if ((guard = zend_hash_find(zobj->guards, property_info->name)) != NULL) {
- if (str) {
- zend_string_release(str);
- }
+ } else if ((guard = zend_hash_find(zobj->guards, Z_STR_P(member))) != NULL) {
return &Z_LVAL_P(guard);
}
ZVAL_LONG(&stub, 0);
- guard = zend_hash_add_new(zobj->guards, property_info->name, &stub);
- if (str) {
- zend_string_release(str);
- }
+ guard = zend_hash_add_new(zobj->guards, Z_STR_P(member), &stub);
return &Z_LVAL_P(guard);
}
/* }}} */
@@ -500,7 +478,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
/* magic get */
if (zobj->ce->__get) {
- zend_long *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, member);
if (!((*guard) & IN_GET)) {
zval tmp_object;
@@ -633,7 +611,7 @@ found:
/* magic set */
if (zobj->ce->__set) {
- zend_long *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, member);
if (!((*guard) & IN_SET)) {
zval tmp_object;
@@ -807,7 +785,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
}
if (!zobj->ce->__get ||
- (guard = zend_get_property_guard(zobj, property_info, member)) == NULL ||
+ (guard = zend_get_property_guard(zobj, member)) == NULL ||
(property_info && ((*guard) & IN_GET))) {
ZVAL_NULL(&tmp);
@@ -873,7 +851,7 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
/* magic unset */
if (zobj->ce->__unset) {
- zend_long *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, member);
if (!((*guard) & IN_UNSET)) {
zval tmp_object;
@@ -1481,7 +1459,7 @@ found:
result = 0;
if ((has_set_exists != 2) && zobj->ce->__isset) {
- zend_long *guard = zend_get_property_guard(zobj, property_info, member);
+ zend_long *guard = zend_get_property_guard(zobj, member);
if (!((*guard) & IN_ISSET)) {
zval rv;