|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-11-28 20:50 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 05:00:01 2025 UTC |
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();