php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12277 in PHP4 constructors still seem to behave like in PHP3
Submitted: 2001-07-20 07:51 UTC Modified: 2001-11-17 13:42 UTC
From: jack at mobil dot cz Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.5 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jack at mobil dot cz
New email:
PHP Version: OS:

 

 [2001-07-20 07:51 UTC] jack at mobil dot cz
the following code:
<?
class A {
    function A() {
        echo "I am the constructor of A.<br>\n";
    }
}

class B extends A {
    function C() {
        echo "I am a regular function C.<br>\n";
    }
}

class C extends B {
}

$b = new C();
?> 
in PHP 4.0.5 prints:
I am a regular function C.<br>

is this correct?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-17 13:42 UTC] mfischer@php.net
This is a current implementation limitation.

Just define your real C constructor and access the other C method with parent::C().

Closed.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jul 07 01:04:05 2022 UTC