ID:               44571
 Updated by:       [EMAIL PROTECTED]
 Reported By:      travisghansen at yahoo dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: linux
 PHP Version:      5.2.6RC3
 New Comment:

Says the documentation:
"Note: Parent constructors are not called implicitly if the child class
defines a constructor."

Then, it was really a bug, though many codes have used this old
behavior.


Previous Comments:
------------------------------------------------------------------------

[2008-03-30 15:41:47] [EMAIL PROTECTED]

The old behavior was changed in Bug #44141.

------------------------------------------------------------------------

[2008-03-30 15:22:50] travisghansen at yahoo dot com

Description:
------------
The code below has worked fine in all php 5 releases (that I've used
for the past year and a half anyway).  It now dies with 5.2.6.

Reproduce code:
---------------
class BaseLoginDA
{
    protected $dbg;
    private static $instance;
    private function __construct(){
        echo __METHOD__;
    }
}
class LoginDA extends BaseLoginDA {
    private static $instance;
    //implementing the singleton pattern
    static function getInstance(){
        if (self::$instance){
            return self::$instance;
        }
        else {
            self::$instance = new LoginDA();
            return self::$instance;
        }
    }
}
$loginDA=LoginDA::getInstance();

Expected result:
----------------
an instantiated LoginDA object

Actual result:
--------------
Fatal error: Call to private BaseLoginDA::__construct() from context
'LoginDA'


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44571&edit=1

Reply via email to