From a035f418cc73177e7c7d7a25a8738d2188b9920e Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Wed, 18 Dec 2024 09:49:31 +0100 Subject: [PATCH] Improve stream filter removal --- CHANGELOG.md | 3 ++- src/Stream.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4a253a..f33a0ab3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ All Notable changes to `Csv` will be documented in this file ### Fixed -- None +- [#554](https://github.com/thephpleague/csv/pull/544) Fix stream filte removal +- Fix Statement callaback signature ### Removed diff --git a/src/Stream.php b/src/Stream.php index 674c9e17..3190314d 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -83,7 +83,9 @@ public function __destruct() { array_walk_recursive($this->filters, static function ($filter): void { if (is_resource($filter)) { - @stream_filter_remove($filter); + set_error_handler(fn (int $errno, string $errstr, string $errfile, int $errline) => true); + stream_filter_remove($filter); + restore_error_handler(); } });