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>
This commit is contained in:
Vincent Petry 2021-08-26 10:23:03 +02:00
parent 60e44077b7
commit 9c6bbfac45
No known key found for this signature in database
GPG key ID: E055D6A4D513575C

View file

@ -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;
}