|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-11-18 16:59 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Feb 10 19:00:01 2026 UTC |
Description: ------------ If a child class directly references a property defined in the parent class, it no longer inherits it. Reproduce code: --------------- <?php class base { public $x = 1; } class foo extends base { } class bar extends base { public function bartest() { var_dump($this->x); } } $base = new base; print_r($base); $foo = new foo; print_r($foo); $bar = new bar; print_r($bar); $bar->bartest(); ?> Expected result: ---------------- base Object ( [x] => 1 ) foo Object ( [x] => 1 ) bar Object ( [x] => 1 ) int(1) Actual result: -------------- base Object ( [x] => 1 ) foo Object ( [x] => 1 ) bar Object ( ) Notice: Undefined property: bar::$x in /path/bug.php on line 12 NULL