Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94088 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83356 invoked from network); 17 Jun 2016 18:00:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jun 2016 18:00:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.50 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.50 mail-wm0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:38353] helo=mail-wm0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/FA-18862-5CA34675 for ; Fri, 17 Jun 2016 14:00:37 -0400 Received: by mail-wm0-f50.google.com with SMTP id m124so9506604wme.1 for ; Fri, 17 Jun 2016 11:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=Y8CAgIrseAaIH+Ek8sBCSjes1CVMCxTWrGr1WUwvBpw=; b=hrPpu7ddqR80hVRYm23Kwj+Asc+MxoX9He31S//9j3dO3SZq7WR8Pw/7hL9lNSwS2f oEGvFiu/Ahi/EMxcagnFnNX6JyiImgbw+octAY/yHfTAyCItWJ8khnBQamWXZYOkKla/ riDby+K5m+nxkfyJDeERXigH/qIQ5ZMp9WDJ16lZb/8Smav3viZgFW6kFhbfAHnd4SfO j6yIJUUVlKbPjivvdxobmNrHjwjc0Z8FuCEjb3xOGMyX6gEHDwp0kTH6jmMeUTWuwo/Y jphc+tpiijOA9ZTQbMhKW3bIJTvVj82XsMYy09bdw87om0GocS2ift7zsdYKYyiYlnbp tL8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Y8CAgIrseAaIH+Ek8sBCSjes1CVMCxTWrGr1WUwvBpw=; b=XG8D5pEBGP+xKP/n04mUTBG4ErV2NeSoAJEo84QKVGZEL1Iod1gg7v3OFFJEcITMyt 74L0O4SY6PnfRkW7494MXfHXwkLQIUQsg23TrmwfCLppfg6tkS2ckYTmVYmyE6HYM8cM 0i2phICL5JbtixZ16buWOrZw/xGI5tv5MHvlCLXVPLmt3eERk5XobYOCt008lMUyA5DI 0WIiauPN/C9S3Fdk7scMgd0dyeZSUyR2ereKwSmbpmxb33JxgLse1XcUuTSM5uEVt7YC Ojqu6bk9c5N1N22OCesjdNVj9ae3/QBR/E68wKMZglMk5nskyddpL12QBXYOA6KSIrJH gcZA== X-Gm-Message-State: ALyK8tJDa1Iqz2ABPz3uaR7fKVhQ1l1SGYtS4p9AmWNLXKbgjjDKwaymUMENEkg/9yq5Kg== X-Received: by 10.194.171.133 with SMTP id au5mr3441395wjc.60.1466186433576; Fri, 17 Jun 2016 11:00:33 -0700 (PDT) Received: from [192.168.0.98] ([93.188.182.58]) by smtp.gmail.com with ESMTPSA id h8sm49859130wjg.9.2016.06.17.11.00.32 for (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Jun 2016 11:00:32 -0700 (PDT) To: internals@lists.php.net References: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> <98f97016-066e-b5a4-8d1d-4bca179315fa@gmx.de> Message-ID: <7fa29dd7-364d-59ae-a98b-cf701b41f34d@gmail.com> Date: Fri, 17 Jun 2016 18:58:54 +0100 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Throwing an Error for require expressions in PHP7.x From: rowan.collins@gmail.com (Rowan Collins) 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. > 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. Regards, -- Rowan Collins [IMSoP]