Re: [RFC] Stream Error Handling Improvements
| From: | Christian Schneider | Date: | Tue, 30 Dec 2025 08:22:43 +0000 |
| Subject: | Re: [RFC] Stream Error Handling Improvements | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129722@lists.php.net to get a copy of this message | ||
Am 29.12.2025 um 19:52 schrieb Jakub Zelenka <bukka@php.net>:
> - The storing of errors is done at the end of the operation grouping and contains only the last
> grouped errors. So the function name was changed to stream_get_last_error(). It returns just a
> single StreamError which has a next property pointing to the next error if there is any.
I assume the chaining was based on Exception chaining but the example code under
https://wiki.php.net/rfc/stream_errors#error_chaining
looks a bit clunky to me and I was wondering if returning an array of StreamError would not be more
straightforward, i.e. one could then use foreach, empty(), count(), array_first(), array_last(),
array_find() etc. instead of methods like while, $e->count(), $e->hasCode() which would make
it feel more idiomatic to me.
But then again it might be a matter of taste and/or I might have missed something.
Regards,
- Chris