Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94105 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41043 invoked from network); 18 Jun 2016 10:34:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2016 10:34:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.20 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.20 mout.gmx.net Received: from [212.227.17.20] ([212.227.17.20:58420] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/52-18862-E9325675 for ; Sat, 18 Jun 2016 06:34:07 -0400 Received: from [192.168.2.102] ([217.82.228.97]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0M3zG2-1bWZRI1g0Y-00rbU2; Sat, 18 Jun 2016 12:34:02 +0200 To: Rowan Collins , internals@lists.php.net References: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> <98f97016-066e-b5a4-8d1d-4bca179315fa@gmx.de> <7fa29dd7-364d-59ae-a98b-cf701b41f34d@gmail.com> Message-ID: <852974b0-df1d-3942-808f-8ae1238015d2@gmx.de> Date: Sat, 18 Jun 2016 12:34:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <7fa29dd7-364d-59ae-a98b-cf701b41f34d@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:rnhgViAIwD9QF2w9cd3mVNRO4KSDIXwJ0lqdJGE5r7aUJxR0Ecm ud4q6h1g6Jga68x211HfIO55x5y304mcaPvNG43lnmLQmb4WTX7Jam/lcp+XITLzeGIQGIt BHUjTWPYUyKX4+BrBMpk97DWLwbNQraq25X2CCL7MEDUUyMEQ4L+9AkYbXckCXIuELZEOMS RKJe5naevKz+0ne/pPklA== X-UI-Out-Filterresults: notjunk:1;V01:K0:tCMqkssXXtA=:upg//d1Mh3+TplcMuukuu5 y3mREm9HDw81VJIljUlnwHc6yF+KHnIgZDszT6OLAamB5hkaDuPeNT0av7kkghh3Eoj5j+EYw Ahz3kpryo/7B8c4wbCgHdh7Ml7WyMbXYY3vsGjVD77F8F6PpypSCaV7rGp5dpA6LFky2fJsWp jJ/T5yYS4OSZ5Z3hznS591WxXvZtW8e6wWt5bY/CKTiy4u8Z6pH1inYWDco1DFC72kSaKGq/g ppV9FmEmOFcuQz9WBFfDfkrE3QXyCykBVXDNooH+SvNyTGAcd0Ps0dCSiBG2raO8/DmHdHXB8 9JqLKEl6FZQje0JzXiL5FxSG8zXW32x0M41sPgTYk1l6wYxfQXIcqNSooNdw5/Rnic8hu1tqg ixi6S7CN0wR9+9s6Q/hZ6McBti3UxnSKWjpiisFqnAYa8U61pJndZRtxpm256pghvgT1qbASR tZI81RRR+9vy0Y2oa3ifPVuPpu/QjamL68np7e+dvI+2PkTO9b5sebHqdXjLkVufVi8wmxq80 3HRDiAY47B54n9VndZD0BsHrfxD2NB9d4zmd3McUTCMoQ5HWGi/tzaF3KMAqrAaJfawSbQMwE 4tqjqc8RWvIgoBUw57Kr2l4/OEejAvmk6xUk/4XuJ7O/VSsKp85i8dFQXGYmVjMdrtbrnhKyf G8Npf/9TjvukvwGjqdpkFgwCZ6zIjBkI6pmCF+Qy0DrEk3e2xGNF9otMHcjkuLXw0evEfL2tW sHeVY3SYFff/CV5K4Z/14Y7WrlLIee8NBqBJubP1wYIu1Ls+AI5L7WJ2RCCLYnaSsoqZRn3UJ J73GGiY Subject: Re: [PHP-DEV] Throwing an Error for require expressions in PHP7.x From: cmbecker69@gmx.de (Christoph Becker) 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 one >> course of action, namely to bail out. In my opinion, this is the least >> surprising way to handle missing required files, especially as it always >> has been that way (consider the potential BC break). > > As Alexander has pointed out, there is no BC break, unless you are using > 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 – this suggestion is about PHP 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 situation > 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. -- Christoph M. Becker