Hi Jakub,

On Tue, Nov 18, 2025 at 7:39 PM Jakub Zelenka <[email protected]> wrote:
>
> Hello,
>
> I would like to introduce a new stream error handling RFC that is part of my 
> stream evolution work (PHP Foundation project funded by Sovereign Tech Fund) :
>
> https://wiki.php.net/rfc/stream_errors
>
> Kind regards,
>
> Jakub

Thank you for working on this.

The RFC doesn't specify when exactly the error_handler is invoked
(especially in case of non-fatal errors). Is it as soon as the error
happens, or are invocations batched at the end of the operation?

The reason I'm asking is because there is a long track of bugs related
to the global error handler [1], and it's likely that the
error_handler proposed here could suffer from the same issues. For
example the error_handler can reenter the operation being performed,
or change the state of the stream. For safety and simplicity, I would
suggest that error_handler calls are delayed until just before
returning to user code.

[1] https://github.com/php/php-src/issues/20018

Best Regards,
Arnaud

Reply via email to