php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20784 __construct doesn't get called
Submitted: 2002-12-03 04:59 UTC Modified: 2002-12-03 05:00 UTC
From: jalonso at art3mis dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.0RC2 OS: Debian Linux
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: jalonso at art3mis dot com
New email:
PHP Version: OS:

 

 [2002-12-03 04:59 UTC] jalonso at art3mis dot com
<?php
echo phpversion().chr(10);

class BaseClass {
    function __construct() {
        print "In BaseClass constructor\n";
    }
}

class SubClass extends BaseClass {
    function __construct() {
        parent::__construct();
        print "In SubClass constructor\n";
    }
}

$obj = new BaseClass();
$obj = new SubClass();
?>

This example ( taken from: http://www.php.net/source.php?url=/zend2_example.phps )

gives me the following output:

--output--
4.3.0RC2
----------

So __construct() doesn't seem to be called. 

If I rename __construct to BaseClass i get this output:
--output--
4.3.0RC2
In BaseClass constructor
In BaseClass constructor
----------

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-03 05:00 UTC] jalonso at art3mis dot com
<?php
echo phpversion().chr(10);

class BaseClass {
    function __construct() {
        print "In BaseClass constructor\n";
    }
}

class SubClass extends BaseClass {
    function __construct() {
        parent::__construct();
        print "In SubClass constructor\n";
    }
}

$obj = new BaseClass();
$obj = new SubClass();
?>

This example ( taken from: http://www.php.net/source.php?url=/zend2_example.phps )

gives me the following output:

--output--
4.3.0RC2
----------

So __construct() doesn't seem to be called. 

If I rename __construct() on BaseClass class to BaseClass() i get this output:
--output--
4.3.0RC2
In BaseClass constructor
In BaseClass constructor
----------
 [2002-12-03 05:00 UTC] derick@php.net
4.3.0RC2 doesn't come with Zend Engine 2; from PHP 5 on this will be the used engine.

not a bug -> bogus

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 15:01:27 2024 UTC