|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8965 Superclass constructor not invoked when subclass also contains a constructor
Submitted: 2001-01-28 06:25 UTC Modified: 2001-02-22 10:50 UTC
From: jeff at iomojo dot com Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.4pl1 OS: RedHat 7.0
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.
Block user comment
Status: Assign to:
Bug Type:
From: jeff at iomojo dot com
New email:
PHP Version: OS:


 [2001-01-28 06:25 UTC] jeff at iomojo dot com
If we have 2 classes:

class A {
  // constructor
  function A() {
    // do things

class B extends A {
  // constructor
  function B() {
    // do things

When a B object is first created, its constructor is called but the constructor for class A is not.  For things to work as expected, the constructor for class A must be called as with class C below.

class C extends A {
  // constructor
  function C() {
    // do things
    // Manually exec the constructor for class A

Not that it should matter, but my configure command is below:

'./configure' '--with-apxs=/usr/sbin/apxs' '--enable-track-vars' '--enable-magic-quotes' '--enable-sigchild' '--enable-calendar' '--enable-ftp' '--with-gd=shared' '--with-mysql=/usr/local' '--with-pdflib=shared' '--enable-wddx' '--enable-sysvmem' '--enable-sysvshm' '--with-xml' '--with-zlib' '--with-ttf' '--enable-sockets'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-22 10:50 UTC]
This is by design. 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 15:01:29 2024 UTC