#36075 [Bgs]: php4.4.1 constructors are called twice

From: Date: Thu, 19 Jan 2006 00:59:04 +0000
Subject: #36075 [Bgs]: php4.4.1 constructors are called twice
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92164@lists.php.net to get a copy of this message
ID: 36075 User updated by: koukine at gmail dot com Reported By: koukine at gmail dot com Status: Bogus Bug Type: Class/Object related Operating System: Windows XP Pro SP2 PHP Version: 4.4.2 New Comment: Yes, I did but unfortunatly I did not isolate as much as the one I posted. It is the other code of our application which was actually going through the all objects and instantiating them. Extreamly sorry and THANKS A LOT. It was helpful. Previous Comments: ------------------------------------------------------------------------ [2006-01-19 01:45:19] tony2001@php.net PHP doesn't call parent constructors at all (and this is expected). Did you actually run this code? It produces only "BBB; ". ------------------------------------------------------------------------ [2006-01-19 01:35:29] koukine at gmail dot com Description: ------------ 1. Parent constructor should be called first 2. This class consutructor shold be called once Reproduce code: --------------- <? class A{ function A(){ print("AAA; "); } } class B extends A{ function B(){ print("BBB; "); } } $b = &new B(); ?> Expected result: ---------------- AAA;BBB Actual result: -------------- BBB; AAA; BBB; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36075&edit=1

« previous php.bugs (#92164) next »