From 57ba18f47f18886f3ea31df5eca399e83609e4b6 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 24 Apr 2018 11:34:08 +0200 Subject: Use better way to determine stream type in encryption stream wrapper Signed-off-by: Robin Appelman --- lib/private/Files/Stream/Encryption.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 05be5a5b286..65d379c0289 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -195,10 +195,10 @@ class Encryption extends Wrapper { protected static function wrapSource($source, $context, $protocol, $class, $mode = 'r+') { try { stream_wrapper_register($protocol, $class); - if (@rewinddir($source) === false) { - $wrapped = fopen($protocol . '://', $mode, false, $context); - } else { + if (self::isDirectoryHandle($source)) { $wrapped = opendir($protocol . '://', $context); + } else { + $wrapped = fopen($protocol . '://', $mode, false, $context); } } catch (\BadMethodCallException $e) { stream_wrapper_unregister($protocol); -- cgit v1.2.3