php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13882 parent class isn`t correctly resolved when child class is included
Submitted: 2001-10-31 04:28 UTC Modified: 2001-11-21 13:19 UTC
From: sanya at mail dot ru Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.6 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sanya at mail dot ru
New email:
PHP Version: OS:

 

 [2001-10-31 04:28 UTC] sanya at mail dot 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-31 19:19 UTC] sniper@php.net
Works fine here with latest CVS. Try the latest dev build from:

http://www.php4win.com/

--Jani

 [2001-11-21 13:19 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 12:01:32 2025 UTC