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 <vincent@nextcloud.com>
pull/28604/head
Vincent Petry 2021-08-26 10:23:03 +07:00
parent fd6c5a134f
commit 2032ca7457
No known key found for this signature in database
GPG Key ID: E055D6A4D513575C
1 changed files with 1 additions and 1 deletions

@ -213,7 +213,7 @@ class Encryption extends Wrapper {
} else {
$wrapped = fopen($protocol . '://', $mode, false, $context);
}
} catch (\BadMethodCallException $e) {
} catch (\Exception $e) {
stream_wrapper_unregister($protocol);
throw $e;
}