2016-06-15 19:38 GMT+02:00 Fleshgrinder <p...@fleshgrinder.com>:

> 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
>
>

Reply via email to