Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94017 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61668 invoked from network); 15 Jun 2016 17:39:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jun 2016 17:39:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.89 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.89 mx108.easyname.com Received: from [77.244.243.89] ([77.244.243.89:57933] helo=mx204.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/13-41914-3C291675 for ; Wed, 15 Jun 2016 13:39:16 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bDEmX-0003uG-6o; Wed, 15 Jun 2016 17:39:13 +0000 Reply-To: internals@lists.php.net References: To: Alexander Lisachenko , PHP internals list Message-ID: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> Date: Wed, 15 Jun 2016 19:38:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KptMXhC79x1sCUqWx8MefU0xLCwj13otH" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] Throwing an Error for require expressions in PHP7.x From: php@fleshgrinder.com (Fleshgrinder) --KptMXhC79x1sCUqWx8MefU0xLCwj13otH Content-Type: multipart/mixed; boundary="ChDIW4SRd5PVLIURvfG6MRgkPTqmJWkBF" From: Fleshgrinder Reply-To: internals@lists.php.net To: Alexander Lisachenko , PHP internals list Message-ID: <2635b3b6-b971-9fb7-5def-26b86eafb54d@fleshgrinder.com> Subject: Re: [PHP-DEV] Throwing an Error for require expressions in PHP7.x References: In-Reply-To: --ChDIW4SRd5PVLIURvfG6MRgkPTqmJWkBF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/15/2016 12:27 PM, Alexander Lisachenko wrote: > For PHP7 we have pretty errors for almost everything, even eval can thr= ow a > ParseError exception, but not for the require expression, because it's > still producing an uncatchable fatal errors: >=20 > 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' >=20 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. >=20 We definitely need this but it cannot go into PHP 7.0. --=20 Richard "Fleshgrinder" Fussenegger --ChDIW4SRd5PVLIURvfG6MRgkPTqmJWkBF-- --KptMXhC79x1sCUqWx8MefU0xLCwj13otH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXYZK6AAoJEOKkKcqFPVVrfZgP+gMcV2YADqhjkygc/Ao3rwjq qDDOUw96R7VYSqgGq5I1qJCBvTFXn3OC7EXWTju7L/ha+kXxM9jW5sXBtmV+gK5i 6z5kayCtEW7erLQOiDm7pI1tOuJwyy1JjR0wPDLrMfeSC7fEsK+PVW8yU3fqwZnC BwaTfWxoCpRlv6Ko7FT3+I7TPHE5vXKCXZ6pJ2x66q9t4YQwfN1HFdpTeyjIUOvf BzqzaInJceHDt/1FKDc63GKve6H6SeOyqV4KJe5J7CQUbbrqL5LSe4dU4eDedGh8 j4KBT87HJi2dJ8lI0400aEIsb3Ez/pCM96lorovPN7wWcinqc5cGQskPp9M4tqlj RTgaqINGWGWn8K4/Lc/HscHujZ3UkxBGyqvkY1BbknMIGoC7eOiqjhOKSOSsO0g9 z7dnXpwEuC5ip578i5n0EN9rBv2IbNqCWDtDWCnVMDiGobN8xHwrGoklNzNIhH3D 5/Jbu+bakfTy6mW2jda720ivder2asMHBBuKfgJcvNO38eRFGoGVcb6k4YzXR0QF bkc/8ilbG1zNwf73qPlktsmMUuYasNiE9Kppv3qCZRWuX3XkRzwD2eHU2Npl97t3 ZIkp4WrJdchQ+c81qUa0vKMelrEVTuiEWqt7X5w9nVojdzV11GxEiHaaLD9lnuo9 xvauQgC/383nkf1wH4nc =1Tp9 -----END PGP SIGNATURE----- --KptMXhC79x1sCUqWx8MefU0xLCwj13otH--