From d9464093b4705ce2cba673e2799272a21e98c1e9 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Tue, 2 Apr 2024 09:46:40 +0200 Subject: [PATCH] [FIX] catch warning emitted by fopen in some cases --- .../Setup/class.ilResourceStorageMigrationHelper.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Services/ResourceStorage/classes/Setup/class.ilResourceStorageMigrationHelper.php b/Services/ResourceStorage/classes/Setup/class.ilResourceStorageMigrationHelper.php index bf55d5ae5d7d..0e1e47ad47f5 100644 --- a/Services/ResourceStorage/classes/Setup/class.ilResourceStorageMigrationHelper.php +++ b/Services/ResourceStorage/classes/Setup/class.ilResourceStorageMigrationHelper.php @@ -215,7 +215,13 @@ public function movePathToStorage( ?Closure $file_name_callback = null, ?Closure $revision_name_callback = null ): ?ResourceIdentification { - $open_path = fopen($absolute_path, 'rb'); + try { + // in some cases fopen throws a warning instead of returning false + $open_path = fopen($absolute_path, 'rb'); + } catch (Throwable $e) { + return null; + } + if ($open_path === false) { return null; }