Re: [RFC] Stream Error Handling Improvements
| From: | Jordi Boggiano | Date: | Wed, 19 Nov 2025 09:17:19 +0000 |
| Subject: | Re: [RFC] Stream Error Handling Improvements | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129293@lists.php.net to get a copy of this message | ||
Hey Jakub,
Very nice improvement overall. Beyond the enum comment from Bob/Ignace
I would also think that stream_get_errors() could return an array of
StreamError objects instead of arrays?
readonly class StreamError
{
public function __construct(
public string $message,
public int $code,
public int $severity,
public bool $terminal,
public string $wrapper,
public ?string $param = null,
public ?string $docref = null,
) {}
}
This object could also be passed to the error handlers perhaps as:
function(string $wrapper, ?resource $stream, StreamError $error): void
Just some ideas :)
Best,
Jordi