On 15.06.2016 at 12:27, 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'
>
> See https://3v4l.org/sQeAQ for live demo. What are the reasons not to throw
> Error here? Looks like an oversight for me.
This had recently been reported as feature request, and my reply was:
| With regard to your example: if a file is *required* and it can't
| be included, it doesn't make much sense to go on. If on the other
| hand the file is not really required, just `include` it.
[1] <https://bugs.php.net/72089>
--
Christoph M. Becker
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php