From: thomas dot hebinck at digionline dot de Operating system: Linux PHP version: 5.0.0b1 (beta1) PHP Bug Type: Zend Engine 2 problem Bug description: Call of __get in a construtor does not work
Description: ------------ The call of a property via __get from a constructor called the same way does not work. - $m is created - $m->s creates new class s (via m::__get) - the constructor of s calls $m->d->d_test - m::_get (for $m->d) is NOT called: Notice: Undefined property See the source - it should make it clear ;-) Reproduce code: --------------- class d { public function d_test() { return true; } } class s { function __construct() { global $m; $m->d->d_test(); } function s_test() { } } class m { function __get($property) { switch ($property) { case 'd': return new d; break; case 's': return new s; break; } } } $m=new m; $m->s->s_test(); Expected result: ---------------- just nothing - there is no output to reduce the lines of source code. Actual result: -------------- Notice: Undefined property: m::$d in /www/w23_bug/test_bug.php on line 10 Fatal error: Call to a member function d_test() on a non-object in /www/w23_bug/test_bug.php on line 10 This is the line: $m->d->d_test(); -- Edit bug report at http://bugs.php.net/?id=25187&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25187&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25187&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25187&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25187&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25187&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25187&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25187&r=support Expected behavior: http://bugs.php.net/fix.php?id=25187&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25187&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25187&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25187&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25187&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25187&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25187&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25187&r=gnused