php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11973 Parent's constructor uncallable directly from within child's methods.
Submitted: 2001-07-09 07:43 UTC Modified: 2001-07-09 09:16 UTC
From: ori at corky dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.0.5 OS: Windows 2000 Professional
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ori at corky dot net
New email:
PHP Version: OS:

 

 [2001-07-09 07:43 UTC] ori at corky dot net
Calling a parent class's constructor from a child's method does not work without the parent:: operator, although the parent's constructor is listed in the child's list of method as reported by get_class_methods().

Example script:

<?PHP

class A
{
    function A()
    {
    }
}
class B extends A
{
    function foo()
    {
        A();
    }
}
$obj = new B;
$obj->foo();

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-09 09:16 UTC] brianlmoon@php.net
Try $this->A();

Brian.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC