Skip to content

Commit 1a96fe0

Browse files
committed
fix bug #63982: isset() inconsistently produces a fatal error on protected property
1 parent c6203da commit 1a96fe0

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? 2012, PHP 5.4.12
44

55
- Core:
6+
. Fixed bug #63982 (isset() inconsistently produces a fatal error on
7+
protected property). (Stas)
68
. Fixed bug #63943 (Bad warning text from strpos() on empty needle).
79
(Laruence)
810
. Fixed bug #63882 (zend_std_compare_objects crash on recursion). (Dmitry)

Zend/tests/bug63982.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #63982 (isset() inconsistently produces a fatal error on protected property)
3+
--FILE--
4+
<?php
5+
class Test {
6+
protected $protectedProperty;
7+
}
8+
9+
$test = new Test();
10+
11+
var_dump(isset($test->protectedProperty));
12+
var_dump(isset($test->protectedProperty->foo));
13+
--EXPECTF--
14+
bool(false)
15+
bool(false)

Zend/zend_object_handlers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, const zend_li
435435
#endif
436436

437437
/* make zend_get_property_info silent if we have getter - we may want to use it */
438-
property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key TSRMLS_CC);
438+
property_info = zend_get_property_info_quick(zobj->ce, member, silent || (zobj->ce->__get != NULL), key TSRMLS_CC);
439439

440440
if (UNEXPECTED(!property_info) ||
441441
((EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&

0 commit comments

Comments
 (0)