]> granicus.if.org Git - php/commitdiff
fix standard object handler for properties when type == BP_VAR_IS
authorJoe Watkins <krakjoe@php.net>
Sat, 26 Mar 2016 10:43:56 +0000 (10:43 +0000)
committerJoe Watkins <krakjoe@php.net>
Sat, 26 Mar 2016 11:15:08 +0000 (11:15 +0000)
Zend/zend_object_handlers.c

index 7b31fdc52442daf6dc699c0e68ed0c75bd02728c..9abe3875ef7c217ac530c074619fe38a78370fee 100644 (file)
@@ -552,6 +552,31 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
                goto exit;
        }
 
+       /* magic isset */
+       if ((type == BP_VAR_IS) && zobj->ce->__isset) {
+               zval tmp_object, tmp_result;
+               zend_long *guard = zend_get_property_guard(zobj, Z_STR_P(member));
+
+               if (!((*guard) & IN_ISSET)) {
+                       ZVAL_COPY(&tmp_object, object);
+                       ZVAL_UNDEF(&tmp_result);
+
+                       *guard |= IN_ISSET;
+                       zend_std_call_issetter(&tmp_object, member, &tmp_result);
+                       *guard &= ~IN_ISSET;
+       
+                       if (!zend_is_true(&tmp_result)) {
+                               retval = &EG(uninitialized_zval);
+                               zval_ptr_dtor(&tmp_object);
+                               zval_ptr_dtor(&tmp_result);
+                               goto exit;
+                       }
+
+                       zval_ptr_dtor(&tmp_object);
+                       zval_ptr_dtor(&tmp_result);
+               }
+       }
+
        /* magic get */
        if (zobj->ce->__get) {
                zend_long *guard = zend_get_property_guard(zobj, Z_STR_P(member));