Bug #13882 Updated: parent class isn`t correctly resolved when child class is included
| From: | sniper@php.net | Date: | Thu, 01 Nov 2001 00:19:20 +0000 |
| Subject: | Bug #13882 Updated: parent class isn`t correctly resolved when child class is included | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69434@lists.php.net to get a copy of this message | ||
ID: 13882
Updated by: sniper
Reported By: sanya@mail.ru
Old Status: Open
Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Windows
PHP Version: 4.0.6
New Comment:
Works fine here with latest CVS. Try the latest dev build from:
http://www.php4win.com/
--Jani
Previous Comments:
------------------------------------------------------------------------
[2001-10-31 04:28:22] sanya@mail.ru
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 this bug report at http://bugs.php.net/?id=13882&edit=1