]> granicus.if.org Git - php/commitdiff
fix bug #63982: isset() inconsistently produces a fatal error on protected property
authorStanislav Malyshev <stas@php.net>
Mon, 14 Jan 2013 01:08:52 +0000 (17:08 -0800)
committerStanislav Malyshev <stas@php.net>
Mon, 14 Jan 2013 01:08:52 +0000 (17:08 -0800)
NEWS
Zend/tests/bug63982.phpt [new file with mode: 0644]
Zend/zend_object_handlers.c

diff --git a/NEWS b/NEWS
index cfc0fa994b769cd5cc55bc62810310e0206e08e7..28040f7262fc1a853cc960333bacccffa2f1cefa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                                        NEWS
 ?? ??? 2012, PHP 5.4.12
 
 - Core:
+  . Fixed bug #63982 (isset() inconsistently produces a fatal error on 
+    protected property). (Stas)
   . Fixed bug #63943 (Bad warning text from strpos() on empty needle).
     (Laruence)
   . Fixed bug #63882 (zend_std_compare_objects crash on recursion). (Dmitry)
diff --git a/Zend/tests/bug63982.phpt b/Zend/tests/bug63982.phpt
new file mode 100644 (file)
index 0000000..31294f3
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Bug #63982 (isset() inconsistently produces a fatal error on protected property)
+--FILE--
+<?php
+class Test {
+        protected $protectedProperty;
+}
+
+$test = new Test();
+
+var_dump(isset($test->protectedProperty));
+var_dump(isset($test->protectedProperty->foo));
+--EXPECTF--
+bool(false)
+bool(false)
index 3881c0e8708d9dd46537685f227aee92246ffcc9..2c2a45d72676e17569bb61ee5c4a45bbf1f5fc5d 100644 (file)
@@ -435,7 +435,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
 #endif
 
        /* make zend_get_property_info silent if we have getter - we may want to use it */
-       property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key TSRMLS_CC);
+       property_info = zend_get_property_info_quick(zobj->ce, member, silent || (zobj->ce->__get != NULL), key TSRMLS_CC);
 
        if (UNEXPECTED(!property_info) ||
            ((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&