Edit report at https://bugs.php.net/bug.php?id=63982&edit=1
ID: 63982 Updated by: s...@php.net Reported by: s...@php.net Summary: isset() inconsistently produces a fatal error on protected property -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: 5.4Git-2013-01-13 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of stas Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a96fe0b3260b4b63627cf69d71a5b350ad3163f Log: fix bug #63982: isset() inconsistently produces a fatal error on protected property Previous Comments: ------------------------------------------------------------------------ [2013-01-14 00:21:03] s...@php.net Description: ------------ <?php class Test { protected $protectedProperty; } $test = new Test(); var_dump(isset($test->protectedProperty->foo)); This produces fatal error. However this: var_dump(isset($test->protectedProperty)); produces bool(false) - even though the very same protected property is accessed. This is obviously inconsistent. It looks like this is caused by this code in zend_std_read_property: property_info = zend_get_property_info_quick(zobj->ce, member, (zobj- >ce->__get != NULL), key TSRMLS_CC); This sets property getter to "silent" for "get" requests, but not for "isset" requests, even though code immediately above is: silent = (type == BP_VAR_IS); But 'silent' value is ignored for zend_get_property_info_quick and it is allowed to produce the fatal error, even though has_property() handler in this situation does not. Test script: --------------- <?php class Test { protected $protectedProperty; } $test = new Test(); var_dump(isset($test->protectedProperty->foo)); Expected result: ---------------- bool(false) Actual result: -------------- Fatal error: Cannot access protected property Test::$protectedProperty ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63982&edit=1