From 0b2446f5f8c70409dd7a272ea7cdd1f24f1c025e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Abramowicz?= Date: Wed, 3 Jan 2024 12:50:14 +0100 Subject: [PATCH] Fix bug #44 Add a catch to cover exceptions thrown in error handlers while handling a PHP warning emitted in some cases with stat on non-existent files. --- src/NativeWrapper.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/NativeWrapper.php b/src/NativeWrapper.php index 6c7fe70..d71fdd3 100644 --- a/src/NativeWrapper.php +++ b/src/NativeWrapper.php @@ -206,6 +206,9 @@ public function url_stat(string $path, int $flags) } catch (\RuntimeException $e) { // SplFileInfo::isFile throws exception return false; + } catch (\ErrorException $e) { + // Warning was converted into an exception by an external error handler + return false; } }