Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62079 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31515 invoked from network); 7 Aug 2012 11:32:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Aug 2012 11:32:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.49 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-qa0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:39269] helo=mail-qa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/A0-25471-8ECF0205 for ; Tue, 07 Aug 2012 07:32:57 -0400 Received: by qafk1 with SMTP id k1so107684qaf.8 for ; Tue, 07 Aug 2012 04:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=mAkctBUPU+67r3Dmr6jJ7hBCQ3BGc6eMk46OcUuDTKQ=; b=KWBDFRS/dCtHAxqra9VdZKyBDxJAgqolDVd8d37fcBwElES9g/iTdpjeU64V4tR1ZV L8fK0tXsBGZcuhqkenMm4KuHSjiyd+JCjNPD4EsAQ/ANJwklU5Y34rIft7x/fxMVO+IK G7wx+O1Id0VbwAhhF6w2vtrXX1umP87Jl8qMorDooEWDAKIzGxHeSrmoPjufumcrMqSa J1vKUtmAx25pJMBCc4V8iCE2rrYww4g48ZKwqR37yLVNdTQce4MYz8JolAO2RDyfSZfr RjrlqgPVl895G1fzxFRu4f3PHAt2t5TXum+BW2s9BJ81hFBU18QLpjLM8KYiSQA5ZlkU Do2g== MIME-Version: 1.0 Received: by 10.224.71.73 with SMTP id g9mr23333108qaj.12.1344339174369; Tue, 07 Aug 2012 04:32:54 -0700 (PDT) Received: by 10.229.182.4 with HTTP; Tue, 7 Aug 2012 04:32:54 -0700 (PDT) In-Reply-To: <5020ABB3.7060400@sugarcrm.com> References: <501F46BE.4040407@sugarcrm.com> <50200FBD.2010506@sugarcrm.com> <5020ABB3.7060400@sugarcrm.com> Date: Tue, 7 Aug 2012 07:32:54 -0400 Message-ID: To: Stas Malyshev Cc: PHP Internals Content-Type: multipart/alternative; boundary=bcaec51ba2c5f2292104c6ab5a9a Subject: Re: [PHP-DEV] Error handling brainstorming From: ircmaxell@gmail.com (Anthony Ferrara) --bcaec51ba2c5f2292104c6ab5a9a Content-Type: text/plain; charset=ISO-8859-1 Stas, On Tue, Aug 7, 2012 at 1:46 AM, Stas Malyshev wrote: > Hi! > > > circumstance. If it's not, you should be checking for existence first > > (via file_exists() or is_readable(), etc)... > > This is exactly how we got into this mess with $x = > isset($a['x'])?$a['x']:null; > We're trying to get out of this mess and you're proposing to build > another mess just like that. A situation like that is not exceptional. It's null either way, therefore no exception should be thrown. (Which is why I said earlier that I wouldn't want most Notices to become exceptions)... > > errors, you can't just fread the return value. You *need* to change your > > execution flow based on that error. Therefore, it is exceptional. > > That's exactly what I am saying. Exceptions should not be a means of > flow control, and that's exactly what are you doing here. Exceptions by very definition are a means of flow control. That's their very purpose. The difference here is that it's a means of flow control when an error means you literally can't continue on in the current flow of execution (such as the fopen case). To continue the current flow would break lots of stuff, because it's expecting a resource. Therefore, the resource not being opened is exceptional... Anthony --bcaec51ba2c5f2292104c6ab5a9a--