From 9c6bbfac45923459b5addbefbd3817bda98aa43d Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 26 Aug 2021 10:23:03 +0200 Subject: [PATCH] Unregister enc stream wrapper for any exception This prevents side effects in tests by properly cleaning up even with expected exceptions. Signed-off-by: Vincent Petry --- lib/private/Files/Stream/Encryption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 007ef6f3560..e1233e76b93 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -212,7 +212,7 @@ class Encryption extends Wrapper { } else { $wrapped = fopen($protocol . '://', $mode, false, $context); } - } catch (\BadMethodCallException $e) { + } catch (\Exception $e) { stream_wrapper_unregister($protocol); throw $e; } -- 2.39.5