Re: Long-Term Planning for PHP 9.0 Error Promotion

From: Date: Sun, 30 Jan 2022 16:56:55 +0000
Subject: Re: Long-Term Planning for PHP 9.0 Error Promotion
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-116955@lists.php.net to get a copy of this message
On Sun, Jan 30, 2022 at 5:41 PM Christian Schneider <cschneid@cschneid.com>
wrote:

> Am 30.01.2022 um 16:55 schrieb Nikita Popov <nikita.ppv@gmail.com>:
> > Something I want to add here is that there is also an important technical
> > motivation behind promoting undefined variable notices to exceptions: The
> > big problem with these (from a pure implementation perspective) is that
> we
> > need to throw the warning and continue running. But the warning might
> call
> > a custom error handler, which may modify state that the virtual machine
> > does not expect to be modified. The PHP VM plays increasingly complex
> games
> > to prevent this, but despite all that complexity, this problem cannot be
> > fully solved while this remains a warning, rather than an exception.
>
>
> Just so it has been mentioned: This could also be addressed by removing
> the warning (-:C
>
> Out of curiosity: If undefined variables would be turned into exceptions,
> is the fact that now almost every operation can throw an exception that
> much easier to handle?
>

Almost every operation can *already* throw an exception -- if something
throws a warning, then that warning may be promoted to an exception by a
custom error handler.

But yes, dealing with exceptions is much simpler, because they abort
control flow.

Regards,
Nikita


Thread (32 messages)

« previous php.internals (#116955) next »