|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2310 Constructor not being called
Submitted: 1999-09-15 16:21 UTC Modified: 2002-06-16 08:58 UTC
From: bobval at zedak dot com Assigned:
Status: Not a bug Package: Other
PHP Version: 3.0.12 OS: Red Hat Linux
Private report: No CVE-ID: None
 [1999-09-15 16:21 UTC] bobval at zedak dot com
I have a class B that extends class A

The constructor for Class never gets called.

class  A  {
       A() {
           print("Hi from Class A");

       Nothing() {
           print("Class A - Nothing");

class B  extends A {
       B()  {
           print("Hi from Class B");

$ClassB = new B;

When I create a class B the B constructor gets called but NOT the class A constructor.  How do I get the A constructor to be called as well?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 08:58 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 02:01:30 2024 UTC