Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61699 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51078 invoked from network); 24 Jul 2012 17:20:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 17:20:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.213.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:54657] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D5/B1-42538-669DE005 for ; Tue, 24 Jul 2012 13:20:39 -0400 Received: by yenl12 with SMTP id l12so7900174yen.29 for ; Tue, 24 Jul 2012 10:20:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=aXvzkgdUfyVPSHT4QRleDqgksX2oRiQJgkZCBcCAdUw=; b=i5yCa/N7DUIDGU39Zo375L8zghqC882wYv35QLfT9Rsukjkh7/xI1HMEwxCG4zfIHm FmkDHW9ZMb+UANErkIh5hXgPSGJHQo9UQdUXD6BcqAGNEwXiC2yJYV8oIagzYb+RZ8Co itpN7VmjidEfjfMRoA7hUtR22osF4mI7+pxvMCUQA/OyncGu8UyDftYKciJI/81+RRyd jSH1aZd4pUXCHE1yaV8G1A956/VsqGy2uvcnslo3Tl52vijSO5rtSbNIkSmR6KZvugqz iTict6LpdHwim0Gh2ng2JO5hqc4q4XldvJB0J5n0Jp14hsGx11dr/aYXDEM1Dwld+6du 84LA== Received: by 10.236.157.4 with SMTP id n4mr5764135yhk.112.1343150436277; Tue, 24 Jul 2012 10:20:36 -0700 (PDT) Received: from [172.16.26.30] ([38.106.64.245]) by mx.google.com with ESMTPS id n15sm15962266anh.6.2012.07.24.10.20.34 (version=SSLv3 cipher=OTHER); Tue, 24 Jul 2012 10:20:35 -0700 (PDT) Message-ID: <500ED960.9020505@lerdorf.com> Date: Tue, 24 Jul 2012 10:20:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Nikita Popov CC: Laruence , PHP Internals References: <500EBC47.2080200@lerdorf.com> In-Reply-To: X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmIw7H8qmMMgusFYVTz8n++rxuevMHdR42067Kn2ssT3BF2+PdtPFQnRwyNEtcAchcHB93G Subject: Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions From: rasmus@lerdorf.com (Rasmus Lerdorf) On 07/24/2012 10:01 AM, Nikita Popov wrote: > Another, separate point against finally is that in PHP (unlike many > other languages) most (all?) built-in resources clean up after > themselves. So if you open a file you don't have to worry about > closing it again. It'll do that all by itself as soon as it goes out > of scope. The same applies to database handles, etc. As PHP uses > refcount based garbage collection the resource is actually cleaned up > right away, not just at the next GC run (which could be problematic if > you open up many files in a row). Which is the argument for why finally doesn't need to worry about the fatal-error case. Most resources are cleaned up on a fatal already, including your lock example, so it isn't an issue. finally is exception-level for intra-app cleanup, not for request shutdown cleanup. We already have shutdown functions for that case. -Rasmus