Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8437 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24428 invoked by uid 1010); 8 Mar 2004 09:28:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 24072 invoked from network); 8 Mar 2004 09:28:05 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 8 Mar 2004 09:28:05 -0000 Received: from [192.168.1.105] (unknown [80.142.186.172]) by shiva.mind.de (Postfix) with ESMTP id 5D0D297E94; Sun, 7 Mar 2004 23:35:54 +0100 (CET) Date: Sun, 7 Mar 2004 23:35:36 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <6329292984.20040307233536@marcus-boerger.de> To: Ard Biesheuvel Cc: internals@lists.php.net In-Reply-To: <20040306172140.51328.qmail@pb1.pair.com> References: <20040306172140.51328.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] __destruct() behaviour From: helly@php.net (Marcus Boerger) Hello Ard, Saturday, March 6, 2004, 6:21:38 PM, you wrote: > While http://www.php.net/zend-engine-2.php claims the following > 'Like constructors, parent destructors will not be called > implicitly by the engine. In order to run a parent destructor, > one would have to explicitly call parent::__destruct() in the > destructor body. > the following code > php -r 'abstract class A { protected function __destruct() {} } > class B extends A {} > $b = new B;' > results in > Warning: Call to protected B::__destruct() from context '' > during shutdown ignored in Unknown on line 0 > which is inconsistent with the quoted description. > It also introduces an asymmetry compared to constructors which I think > is confusing. > Any thoughts ? Yes your understanding and your code is wrong. In your code you explicitly decalre that the destructor may only be called from that class's context. Normally this results in an E_ERROR. But when it happens we only issue an E_WARNING because the E_ERROR would restart the Rshutdown process. -- Best regards, Marcus mailto:helly@php.net