Re: Don't silence fatal errors
| From: | Yasuo Ohgaki | Date: | Thu, 07 Feb 2019 01:25:36 +0000 |
| Subject: | Re: Don't silence fatal errors | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104267@lists.php.net to get a copy of this message | ||
On Thu, Feb 7, 2019 at 10:07 AM Girgias <george.banyard@gmail.com> wrote:
> On Thu, 7 Feb 2019 at 02:03, Pierre Joye <pierre.php@gmail.com> wrote:
>
> > Good morning Nikita,
> >
> > On Tue, Nov 27, 2018, 4:43 AM Nikita Popov <nikita.ppv@gmail.com wrote:
> >
> > > Hi internals,
> > >
> > > When the silencing operator @ is used, the intention is generally to
> > > silence expected warnings or notices. However, it currently also
> silences
> > > fatal errors. As fatal errors also abort request execution, the result
> > will
> > > often be a hard to debug white screen of death.
> > >
> > > The most recent occurrence which motivated me to write this mail is
> > > https://bugs.php.net/bug.php?id=77205, but I've
> > > seen this play out
> > > multiple
> > > times already.
> > >
> > > I would like to propose to change the behavior of @ to only silence
> > > warnings, notices and other low-level diagnostics, but leave fatal
> errors
> > > intake. In particular, the following should not be silenced:
> > >
> >
> >
> > I am surely missing use cases because I wonder why we need @, at all?
> >
> > Yes there are functions generating extra messages and should not, be fro.
> > PHP implementation or from external libraries (wrapping stderr to php
> > errors). All of them could be fixed.
> >
> > Best,
> > Pierre
> >
>
> The most common case which comes to mind is to suppress erros while file
> reading.
> Because even if you check a file exists it could be deleted inbetween the
> check and the
> read command. As you can see this is even written in the documentation [1]
>
> Best regards
>
> George Peter Banyard
>
> [1] https://secure.php.net/manual/en/function.fopen.php
If a developer decides to write sloppy code, then @ may be acceptable.
I wouldn't use @, though.
IMO, there should be INI switch that kills @ operator.
There is extension module for this purpose, but PHP itself should have it.
@ operator is convenient, but @ is evil and make debugging a lot harder.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net