Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53083 invoked from network); 25 Feb 2015 14:07:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 14:07:08 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.178 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.178 mail-vc0-f178.google.com Received: from [209.85.220.178] ([209.85.220.178:43320] helo=mail-vc0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/52-62407-B07DDE45 for ; Wed, 25 Feb 2015 09:07:08 -0500 Received: by mail-vc0-f178.google.com with SMTP id hq11so1373292vcb.9 for ; Wed, 25 Feb 2015 06:07:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=W2kOzMU5AKh8Mu17JGM09OQ3Mn2/mkTkG6raAaNU5+c=; b=B7vZ9gGYX3tdMWhqFIbciY8AwX5PSoQQScjLudILra79py8BPojSKd0KXZp9SZD7G4 95FsavBdG6fJwW/kqQ/Ksotm3b6hayjTJxsPF0iKo/DhsxiWb0P/qAJayUZy52e9yWEP VzsFquhtYH/tRHRJMpm7JTJ+u5LZxv+DNvEhI2fl9Iu8t/Am4jFom5lfudOBN5YKbAm6 YtiHddidNc6xRv118dSV+Z0/uL39uM3R4Ig3V6ROa4WBj/a5R+25z5L9vMaoyGkKGyq8 VkEKLqNbFBrL7RzM1bwfCy/8aJLhsJ5r3Sr9kcplq6RJ/mLIzeCEqyrojN1CsVhS6EWs Xybw== X-Gm-Message-State: ALoCoQl0hPKAeu+8MXEYM1ooMuEPrjo6NLWAVTOUvvBXLjsGCY+2XKZ8FEBPRVg3Ly/55dVFki6V3HxMS6clF+zdsnpfPEtN4FdGmIOStJt0pkKHOZ81i7XjALaNq6p+f7Yc+lCqdvnqHoK7S47mzzTTi6D8yYikUQ== MIME-Version: 1.0 X-Received: by 10.53.11.76 with SMTP id eg12mr4090112vdd.68.1424873224018; Wed, 25 Feb 2015 06:07:04 -0800 (PST) Received: by 10.52.113.231 with HTTP; Wed, 25 Feb 2015 06:07:03 -0800 (PST) In-Reply-To: <54EDCBD6.70302@gmail.com> References: <54E12349.7070806@gmail.com> <16.9B.05176.AE1C1E45@pb1.pair.com> <54E1C993.1070609@gmail.com> <37.20.01961.31113E45@pb1.pair.com> <54E32CAA.5030600@gmail.com> <54E4FAC2.7060200@gmail.com> <47.89.25547.DD007E45@pb1.pair.com> <54EDCBD6.70302@gmail.com> Date: Wed, 25 Feb 2015 18:07:03 +0400 Message-ID: To: Rowan Collins Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a1133f0565e3a13050fea26b7 Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine From: dmitry@zend.com (Dmitry Stogov) --001a1133f0565e3a13050fea26b7 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 25, 2015 at 4:19 PM, Rowan Collins wrote: > Tony Marston wrote on 21/02/2015 10:08: > >> ""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... >> >>> >>> On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston < >>> TonyMarston@hotmail.com> wrote: >>> >>>> >>>> I disagree. Exceptions were originally invented to solve the >>>> semipredicate problem which only exists with procedural functions, not >>>> object methods. Many OO purists would like exceptions to be thrown >>>> everywhere, but this would present a huge BC break. If it were possible get >>>> these functions to throw an exception ONLY when they are included in a try >>>> ... catch block then this would not break BC at all. >>>> >>>> >>> Tony, first of all - this still breaks BC, because exception is being >>> thrown in a place where it used not to be... >>> >> >> I disagree. The following function calls would not throw exceptions >> fopen(...); >> fwrite(...); >> fclose(...); >> >> while the following code would: >> try { >> fopen(...); >> fwrite(...); >> fclose(...); >> } catch (....) { >> .... >> } >> > > But what about this code, which could well already exist: > > try { > $fh = fopen(...); > $this->processLotsOfDataAndMaybeThrowAnException($fh); > fclose($fh); > } catch (....) { > .... > } > > If fopen() starts throwing exceptions here, that's as much a BC break as > it throwing them everywhere. If it doesn't, the rules for when it should > throw become even more complicated, and useful in even fewer cases. > No. The proposal is only about fatal engine errors, like "Fatal Error: Call to undefined function %s()". Instead of script termination they will throw exceptions. fopen() won't be touched at all. It's out of scope of proposal. Thanks. Dmitry. > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1133f0565e3a13050fea26b7--