Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94020 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66308 invoked from network); 15 Jun 2016 17:53:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2016 17:53:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.216 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.216 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.216] ([81.169.146.216:38744] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/24-41914-FF591675 for ; Wed, 15 Jun 2016 13:53:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1466013180; l=3634; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=/Ta5Ns+5YYl/spLv6TFt1+X7sIoNpwcvjJLoPs+QIL4=; b=mbGOjuDBj7xY4aZPP+oFlZT77GxnjgJI+zjkM1o5HP/S2iVQKAJpHLdSqImcusf70lO xjDxyykzyjzNbVLQnplxjgIqHkRH1dzPaFjya6moGCIroqUE8RPxWoHIBej6btgqzjYyB QbfG8wq5t46wxID5rliYsxkpyBf+bXYmElg= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNKBqT83Q== X-RZG-CLASS-ID: mo00 Received: from mail-lf0-f54.google.com ([209.85.215.54]) by smtp.strato.de (RZmta 38.5 AUTH) with ESMTPSA id q09639s5FHr050S (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 ; Wed, 15 Jun 2016 19:53:00 +0200 (CEST) Received: by mail-lf0-f54.google.com with SMTP id l188so21110515lfe.2 for ; Wed, 15 Jun 2016 10:53:00 -0700 (PDT) X-Gm-Message-State: ALyK8tI1VxlZW4a/v3F6fkS/6yRWRcM1L7gMFsrzp2U8UH5fkjWN0vkP0jA7bOkROMDfqK3mH8F53tlznST7oA== X-Received: by 10.28.20.139 with SMTP id 133mr11211943wmu.19.1466013179918; Wed, 15 Jun 2016 10:52:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.199.67 with HTTP; Wed, 15 Jun 2016 10:52:57 -0700 (PDT) In-Reply-To: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> References: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> Date: Wed, 15 Jun 2016 19:52:57 +0200 X-Gmail-Original-Message-ID: Message-ID: To: PHP Internals Cc: Alexander Lisachenko Content-Type: multipart/alternative; boundary=001a1145b52cd38b24053554caec Subject: Re: [PHP-DEV] Throwing an Error for require expressions in PHP7.x From: me@kelunik.com (Niklas Keller) --001a1145b52cd38b24053554caec Content-Type: text/plain; charset=UTF-8 2016-06-15 19:38 GMT+02:00 Fleshgrinder : > On 6/15/2016 12:27 PM, Alexander Lisachenko wrote: > > For PHP7 we have pretty errors for almost everything, even eval can > throw a > > ParseError exception, but not for the require expression, because it's > > still producing an uncatchable fatal errors: > > > > try { > > require('no.php'); > > } catch (Throwable $e) { > > echo 'Catch!'; > > } finally { > > echo 'Finally?'; > > } > > // Warning: require(no.php): failed to open stream: No such file or > > directory > > // Fatal error: require(): Failed opening required 'no.php' > > > > This is exactly how require is meant to work, just use include as > Christoph said already. These are two distinct features for a reason. > > On 6/15/2016 12:27 PM, Alexander Lisachenko wrote: > > Can we also add FileNotFoundException and use it for all file functions > to > > avoid silencing with "@" operator? Then require expression can throw an > > Error with nested FileNotFoundException. > > > > We definitely need this but it cannot go into PHP 7.0. I think it can go into 7.1. It's not a BC break, as it will still produce a fatal error if the error isn't caught. > > -- > Richard "Fleshgrinder" Fussenegger > > --001a1145b52cd38b24053554caec--