|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-01-14 01:28 UTC] stas@php.net
[2013-01-14 01:28 UTC] stas@php.net
-Status: Open
+Status: Closed
[2013-01-14 01:29 UTC] stas@php.net
[2014-10-07 23:20 UTC] stas@php.net
[2014-10-07 23:31 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
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