Please think if it may break something.
I wasn't able to find out a case.

Thanks. Dmitry.

---------- Forwarded message ----------
From: Dmitry Stogov <dmi...@php.net>
Date: Fri, Oct 17, 2014 at 3:01 PM
Subject: [PHP-CVS] com php-src: Don't make difference between undefined and
unaccessible properies when call __get() and family:
Zend/zend_object_handlers.c
To: php-...@lists.php.net


Commit:    f2fa7a41cfc9854e74148e6f6330181f42372371
Author:    Dmitry Stogov <dmi...@zend.com>         Fri, 17 Oct 2014
15:01:54 +0400
Parents:   6b203aa26243a46775483a1318427b081095c126
Branches:  master

Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=f2fa7a41cfc9854e74148e6f6330181f42372371

Log:
Don't make difference between undefined and unaccessible properies when
call __get() and family

Changed paths:
  M  Zend/zend_object_handlers.c


Diff:
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index d143b00..ba08967 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;


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to