Bug #13882: parent class isn`t correctly resolved when child class is included

From: Date: Wed, 31 Oct 2001 09:28:23 +0000
Subject: Bug #13882: parent class isn`t correctly resolved when child class is included
Groups: php.dev 
Request: Send a blank email to php-dev+get-69401@lists.php.net to get a copy of this message
From: sanya@mail.ru Operating system: Windows PHP version: 4.0.6 PHP Bug Type: Scripting Engine problem Bug description: parent class isn`t correctly resolved when child class is included Code: -- ClassA.php contents ---------------------------------- <?php class A { function Test() { echo "A::Test\n"; } } ?> -- Test.php contents ------------------------------------ <?php include_once('ClassA.php'); class B extends A { function Test() { parent::Test(); } } B::Test(); ?> --------------------------------------------------------- Try to execute Test.php - for example, type php.exe -q Test.php - i recieved application error message on this. The problem seems to be in a buggy parent resove algorithm. On such a cases it incorrectly resolves parent - to class itself (it results in infinite recursion) or raises an exception ("the memory coudn`t be read"). This problem can be "solved" by using real parent`s class name except "parent::", or by doing all such includes "on the same level" -- if some class is included (by include, require, include_once, require_once), all their child classes must be included before the line where parent is included. -- Edit bug report at: http://bugs.php.net/?id=13882&edit=1

« previous php.dev (#69401) next »