com php-src: fix bug #63982: isset() inconsistently produces a fatal error on protected property: NEWS Zend/tests/bug63982.phpt
Zend/zend_object_handlers.c
| From: | Stanislav Malyshev | Date: | Mon, 14 Jan 2013 01:08:52 +0000 |
| Subject: | com php-src: fix bug #63982: isset() inconsistently produces a fatal error on protected property: NEWS Zend/tests/bug63982.phpt Zend/zend_object_handlers.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70933@lists.php.net to get a copy of this message | ||
Commit: 1a96fe0b3260b4b63627cf69d71a5b350ad3163f
Author: Stanislav Malyshev <stas@php.net> Sun, 13 Jan 2013 17:08:52 -0800
Parents: c6203da6c26439ed698193f71e3983be74a4545b
Branches: PHP-5.4 PHP-5.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a96fe0b3260b4b63627cf69d71a5b350ad3163f
Log:
fix bug #63982: isset() inconsistently produces a fatal error on protected property
Bugs:
https://bugs.php.net/63982
Changed paths:
M NEWS
A Zend/tests/bug63982.phpt
M Zend/zend_object_handlers.c
Diff:
diff --git a/NEWS b/NEWS
index cfc0fa9..28040f7 100644
--- 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
index 0000000..31294f3
--- /dev/null
+++ b/Zend/tests/bug63982.phpt
@@ -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)
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 3881c0e..2c2a45d 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -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) &&