Hi Gina,

> Hello Internals,
> 
> I would like to formally propose my idea for exit() as a function brought up 
> to the list on 2024-02-24 [1] with the following RFC:
> https://wiki.php.net/rfc/exit-as-function
> 
> There have been some slight tweaks to the implementation, namely that the 
> transformation from a "constant" to a function is done at compile time and we 
> do not hook into the behaviour of constants any longer.
> 
> Let me know what you think.
> 
> Best regards,
> 
> Gina P. Banyard
> 
> [1] https://externals.io/message/122483

I generally agree :)

My only concern is that if this function throws an error and I catch it, won't 
it proceed against the user's intentions about it. I am concerned that this may 
lead to data corruption and personal information leaks due to unintentional 
data being inserted into the DB.

```
try {
    exit([]);
} catch (Throwable) {
    //
}
```

Probably no one likes to write code like this, and even if there are, there are 
probably very few, but code that is written with the assumption that exit will 
always stop processing may be a little dangerous.

Is it nonsense to always stop processing even if an error occurs? Or, how about 
creating an uncatchable exception class specifically for exits? Or is this 
level of risk negligible?

I am writing down the ideas I came up with, so please excuse me if there are 
any mistakes in my understanding.

Regard,

Saki

Reply via email to