Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21259 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29381 invoked by uid 1010); 16 Dec 2005 19:36:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 29365 invoked from network); 16 Dec 2005 19:36:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2005 19:36:54 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:57845] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 52/BB-14561-55713A34 for ; Fri, 16 Dec 2005 14:36:54 -0500 Received: from [192.168.1.3] (dslb-084-063-011-115.pools.arcor-ip.net [84.63.11.115]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id DFDED35C392; Fri, 16 Dec 2005 20:45:13 +0100 (CET) Date: Fri, 16 Dec 2005 20:38:20 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <124842700.20051216203820@marcus-boerger.de> To: Daine Mamacos Cc: PHP In-Reply-To: <20051216141608.M76819@reverseorder.net> References: <20051216141608.M76819@reverseorder.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] exceptions in the destructor From: helly@php.net (Marcus Boerger) Hello Daine, marcus@zaphod /usr/src/PHP_5_1 $ php -r 'class A{function __destruct(){throw new Exception("A");}} new A;' make: `sapi/cli/php' is up to date. Fatal error: Uncaught exception 'Exception' with message 'A' in Command line code:1 Stack trace: #0 Command line code(1): A::__destruct() #1 {main} thrown in Command line code on line 1 As the code above clearly show, exceptions can be thrown. marcus Friday, December 16, 2005, 3:17:54 PM, you wrote: > Is there any reason why one is not allowed to throw an exception in the > destructor of a class? > I mean, it makes sense, considering this is not always the final step of code, > and it is usually used for finalising things, and it would be a good idea to > know if anything goes wrong at that stage. > Otherwise is there any compromise one can use to "emulate" this feature? > Daine Mamacos. > -- > random signature Best regards, Marcus