Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58247 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 170 invoked from network); 28 Feb 2012 15:52:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2012 15:52:02 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:1274] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/00-34356-028FC4F4 for ; Tue, 28 Feb 2012 10:52:01 -0500 Received: (qmail 31390 invoked by uid 98); 28 Feb 2012 15:52:00 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.03686 secs); 28 Feb 2012 15:52:00 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 28 Feb 2012 15:51:59 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Tue, 28 Feb 2012 09:51:59 -0600 Message-ID: In-Reply-To: References: <01a901ccf622$0645f230$12d1d690$@alliantinternet.com> Date: Tue, 28 Feb 2012 09:51:59 -0600 To: internals@lists.php.net User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] Possibility to add finally to try/catch? From: ceo@l-i-e.com ("Richard Lynch") On Tue, February 28, 2012 8:22 am, Kiall Mac Innes wrote: > +1000 > > This is a feature that I've always wanted in PHP, My main reason being > to > reduce code duplication. eg > > try { > $fh = fopen($filename); > > // Do some work on the file + encounter an error. > throw new Exception(); > } catch (Exception $e) { > // Log an error or something + if ($fh) fclose($fh); //many PHP file errors NULL out the $fh + } - > } finally { - > fclose($fh); - > } Another non-compelling example... Still not saying "finally" is a bad idea. Just want a compelling use case before I would vote... -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE