#29780 [Opn->Fbk]: Constructor isn't called if a class is extended from a built in class

From: Date: Mon, 23 Aug 2004 16:20:22 +0000
Subject: #29780 [Opn->Fbk]: Constructor isn't called if a class is extended from a built in class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-65098@lists.php.net to get a copy of this message
ID: 29780 Updated by: tony2001@php.net Reported By: d dot khan at ventigo dot com -Status: Open +Status: Feedback Bug Type: Zend Engine 2 problem Operating System: Linux (Gentoo) PHP Version: 5.0.1 New Comment: This code: <? class test extends stdClass { function __construct() { echo 'Called in child'; } } $test = new test; ?> works fine and outputs 'Called in child' for me. Please, check it one more time and/or try newer snapshot. Previous Comments: ------------------------------------------------------------------------ [2004-08-21 11:58:01] d dot khan at ventigo dot com Description: ------------ Hello, maybe this is bogus but I found a situation where the OOP engine doesn't behave as - at least I - would expect. I tried to extend the PDO extension and my local construct method isn't called. The engine always calls the parent construct method. Greetings Daniel Khan Reproduce code: --------------- Class rltxPDO extends PDO { function __construct() { echo 'Called in child'; } public static function instance() { static $instance; if (!$instance) { $instance = new rltxPDO(); } return $instance; } } Expected result: ---------------- Output: Called in child Actual result: -------------- Warning: PDO::__construct() expects at least 1 parameter, 0 given ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29780&edit=1

« previous php.bugs (#65098) next »