Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13425 invoked by uid 1010); 14 Sep 2006 18:04:13 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13410 invoked from network); 14 Sep 2006 18:04:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2006 18:04:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=tslettebo@broadpark.no; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=tslettebo@broadpark.no; sender-id=unknown Received-SPF: error (pb1.pair.com: domain broadpark.no from 80.202.4.58 cause and error) X-PHP-List-Original-Sender: tslettebo@broadpark.no X-Host-Fingerprint: 80.202.4.58 osl1smout1.broadpark.no Solaris 9 Received: from [80.202.4.58] ([80.202.4.58:65507] helo=osl1smout1.broadpark.no) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/05-45066-87999054 for ; Thu, 14 Sep 2006 14:04:11 -0400 Received: from osl1sminn1.broadpark.no ([80.202.4.59]) by osl1smout1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0J5L00F6MGTX97A0@osl1smout1.broadpark.no> for internals@lists.php.net; Thu, 14 Sep 2006 20:03:33 +0200 (CEST) Received: from pc ([80.203.129.59]) by osl1sminn1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with SMTP id <0J5L00CYHGTXAFC0@osl1sminn1.broadpark.no> for internals@lists.php.net; Thu, 14 Sep 2006 20:03:33 +0200 (CEST) Date: Thu, 14 Sep 2006 20:03:52 +0200 To: internals@lists.php.net Message-ID: <004801c6d828$237aa710$9a02a8c0@pc> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Mailer: Microsoft Outlook Express 6.00.2800.1807 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 X-MSMail-priority: Normal Subject: Why isn't base class constructors or destructors required to be called? From: tslettebo@broadpark.no (=?iso-8859-1?Q?Terje_Sletteb=F8?=) Hi all. Another issue. :) As usual, I searched the archive first, but found only a few postings from 2004 on the subject, without much clarification, so I'd like to pose the question again. If this has been discussed, I'd welcome hearing what was the outcome of it. In PHP, unlike other languages with support for OO (such as C++ and Java), base class constructors are not automatically called (or enforced being called). I wonder why this is so? If the answer is "flexibility", has the issues arising from this been seriously considered...? This means that if I make a base class "Base", which needs to have its constructor and/or destructor called, to be initialised properly, there's currently _no way_ to enforce that, in PHP (that I know of). This means you risk half-constructed and half-destructed objects around, and in that case, program correctness is compromised. Regards, Terje