Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94106 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46195 invoked from network); 18 Jun 2016 12:30:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2016 12:30:08 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.220 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.220 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.220] ([81.169.146.220:39419] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/D2-18862-DCE35675 for ; Sat, 18 Jun 2016 08:30:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1466253002; l=6614; s=domk; d=kelunik.com; h=Content-Type:To:Subject:Date:From:In-Reply-To:References: MIME-Version; bh=FPS4WdvfhRgMZHSsMLVp6N/Mobcv/3NumupgVj39GQA=; b=uI3JnQyk4HhM2TA89KqNdHM3IIuYj4AoJsd3D3TLD1Sam7xyphATY5tyagLyX5NRTqr DLTJ90ds6+wGGEbhKuHILJZtbvZo0RJVLV1HUPJq2hCBNHe3ljAaGGpauPqznAqyajgeF n1OoYnMMi0Cg3rL+cEr8YC6QAH++7NlmX+M= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtOnM6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f50.google.com ([74.125.82.50]) by smtp.strato.de (RZmta 38.6 AUTH) with ESMTPSA id z06d49s5ICU0I4X (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Sat, 18 Jun 2016 14:30:00 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id a66so20380300wme.0 for ; Sat, 18 Jun 2016 05:30:00 -0700 (PDT) X-Gm-Message-State: ALyK8tKPNb/3NJkAQVA3OY6DCHHjVs+u65WLbpQoX0QROQVItnDs4XGKkG+i2gf3q7rGfv8x86nJQFb9hc50JQ== X-Received: by 10.194.157.10 with SMTP id wi10mr6343904wjb.159.1466253000354; Sat, 18 Jun 2016 05:30:00 -0700 (PDT) MIME-Version: 1.0 References: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> <98f97016-066e-b5a4-8d1d-4bca179315fa@gmx.de> <7fa29dd7-364d-59ae-a98b-cf701b41f34d@gmail.com> <852974b0-df1d-3942-808f-8ae1238015d2@gmx.de> In-Reply-To: <852974b0-df1d-3942-808f-8ae1238015d2@gmx.de> Date: Sat, 18 Jun 2016 12:29:49 +0000 X-Gmail-Original-Message-ID: Message-ID: To: Christoph Becker , Rowan Collins , internals@lists.php.net Content-Type: multipart/alternative; boundary=089e0122ebe23cb5d005358ca150 Subject: Re: [PHP-DEV] Throwing an Error for require expressions in PHP7.x From: me@kelunik.com (Niklas Keller) --089e0122ebe23cb5d005358ca150 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Christoph Becker schrieb am Sa., 18. Juni 2016, 12:34: > On 17.06.2016 at 19:58, Rowan Collins wrote: > > > On 17/06/2016 17:47, Christoph Becker wrote: > >> If something is required, one cannot do without it, so there's only on= e > >> course of action, namely to bail out. In my opinion, this is the leas= t > >> surprising way to handle missing required files, especially as it alwa= ys > >> has been that way (consider the potential BC break). > > > > As Alexander has pointed out, there is no BC break, unless you are usin= g > > an unconditional catch(Error $e) or catch(Throwable $e) - AKA the > > "Pokemon block" (gotta catch 'em all!). Any uncaught Error is still > > fatal, so amounts to zero change in behaviour. > > > > Note that this same line of argument can be applied to many classes of > > error which became Throwable Errors in PHP 7.0, such as ParseError. > > Indeed, but that was a major version =E2=80=93 this suggestion is about P= HP 7.x. > > >> Frankly, I can't see a single > >> good reason to replace the fatal error with an exception for require, > >> but leave include etc. alone. And if include would throw an exception= , > >> I don't see the use of changing require at all. > > > > Because changing include *would* be a breaking change, and in fact make > > the distinction between require and include rather pointless, because > > the whole point of include is that it *doesn't* emit anything fatal if > > the file doesn't exist. > > > > The whole point of exceptions / throwables is that they are fatal by > > default, but handlable in a consistent manner if there is some situatio= n > > that requires it. > > > > As for use cases, consider that you might not be the author of the code > > containing the "require" statement - you might be including some third > > party library that doesn't something wonky, and need to be robust. Or, > > as Alexander points out, you might want to execute "finally" blocks on > > the way out, even though the application is ultimately going to crash. > > Okay, I see now that there are some use cases, but would these justify > the potential BC? I'm not sure. > Which potential BC? The only thing is a catch all handler that has already been adjusted to PHP 7. If you catch an exception you somehow promise to handle it. If you can't handle it, you should rethrow it. I don't think there will be real issues with BC, because it would have otherwise resulted in a non-handleable fatal like before. -- > Christoph M. Becker > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --089e0122ebe23cb5d005358ca150--