#20052 [NEW]: __construct() blocks use of __get() in parent

From: Date: Wed, 23 Oct 2002 22:20:22 +0000
Subject: #20052 [NEW]: __construct() blocks use of __get() in parent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-23140@lists.php.net to get a copy of this message
From: tater@potatoe.com Operating system: OS X 10.1 PHP version: 4CVS-2002-10-23 PHP Bug Type: Zend Engine 2 problem Bug description: __construct() blocks use of __get() in parent If a child class has a __construct() function, it won't make use of its parent's __get() function (and presumably other overload functions too). Workaround: add a __get() to the child class and call parent::__get($property). test code: <?php class a { function __get() { return 'a::_get'; } } class b extends a { } class c extends a { function __construct() { } } class d extends a { function __construct() { } function __get($p) { return parent::__get($p); } } $a = new a; print "a->foo = {$a->foo}\n"; $b = new b; print "b->foo = {$b->foo}\n"; $c = new c; print "c->foo = {$c->foo}\n"; $d = new d; print "d->foo = {$d->foo}\n"; ?> output: PHP Notice: Undefined property: foo in /full/path/overload.php on line 11 overload.php(11) : Notice - Undefined property: foo a->foo = a::_get b->foo = a::_get Notice: Undefined property: foo in /full/path/overload.php on line 11 c->foo = d->foo = a::_get -- Edit bug report at http://bugs.php.net/?id=20052&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20052&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20052&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20052&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20052&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20052&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20052&r=support Expected behavior: http://bugs.php.net/fix.php?id=20052&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20052&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20052&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20052&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20052&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20052&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20052&r=isapi

« previous php.bugs (#23140) next »