From d0dc07ed7504005cb7d96e400faf1782f2c4e568 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 7 Jan 2019 15:23:05 +0100 Subject: [PATCH] explicitly close the streams when doing recursive copy Signed-off-by: Robin Appelman --- lib/private/legacy/util.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index eed49aff3132b..1f4e61cc1943b 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -470,7 +470,10 @@ public static function copyr($source, \OCP\Files\Folder $target) { closedir($dir); return; } - stream_copy_to_stream($sourceStream, $child->fopen('w')); + $targetStream = $child->fopen('w'); + stream_copy_to_stream($sourceStream, $targetStream); + fclose($targetStream); + fclose($sourceStream); } } }