Bug #72056 [NEW]: __get is called for testing if chained property is set
| From: | koubel at seznam dot cz | Date: | Tue, 19 Apr 2016 10:17:33 +0000 |
| Subject: | Bug #72056 [NEW]: __get is called for testing if chained property is set | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200647@lists.php.net to get a copy of this message | ||
From: koubel at seznam dot cz
Operating system: Linux
PHP version: 7.0.5
Package: *General Issues
Bug Type: Bug
Bug description:__get is called for testing if chained property is set
Description:
------------
For classes with implemented __get and __isset, __get is automatically
called when testing only if chained overloaded properties are set,
despite the first property in chain doesn't exist. There is no reason to
call __get anymore.
It's there from the beginning of __get/__isset, So maybe it's feature,
but undocumented?
Test script:
---------------
class Xstd {}
class XOverloading
{
function __isset($name)
{
return FALSE;
}
function __get($name)
{
trigger_error('Error', E_USER_WARNING);
}
}
$obj = new Xstd();
var_dump(isset($obj->prop1->prop2));
$obj = new XOverloading();
var_dump(isset($obj->prop1->prop2));
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(false)
Warning: Error in .... on line 13
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=72056&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72056&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72056&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72056&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72056&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72056&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72056&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72056&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72056&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72056&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72056&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72056&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72056&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72056&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72056&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72056&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72056&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72056&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72056&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72056&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72056&r=mysqlcfg