Skip to content

Commit 67eb432

Browse files
authored
Merge branch 'stable30' into backport/52880/stable30
2 parents 738d927 + 5ce2cf1 commit 67eb432

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,8 @@ private function copyBetweenStorage(
813813
}
814814
}
815815
} else {
816+
$source = false;
817+
$target = false;
816818
try {
817819
$source = $sourceStorage->fopen($sourceInternalPath, 'r');
818820
$target = $this->fopen($targetInternalPath, 'w');
@@ -822,10 +824,10 @@ private function copyBetweenStorage(
822824
[, $result] = \OC_Helper::streamCopy($source, $target);
823825
}
824826
} finally {
825-
if (isset($source) && $source !== false) {
827+
if ($source !== false) {
826828
fclose($source);
827829
}
828-
if (isset($target) && $target !== false) {
830+
if ($target !== false) {
829831
fclose($target);
830832
}
831833
}

tests/lib/Files/ViewTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,9 @@ private function doTestCopyRenameFail($operation) {
11831183
$storage2->method('writeStream')
11841184
->willThrowException(new GenericFileException('Failed to copy stream'));
11851185

1186+
$storage2->method('fopen')
1187+
->willReturn(false);
1188+
11861189
$storage1->mkdir('sub');
11871190
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
11881191
$storage1->mkdir('dirtomove');

0 commit comments

Comments
 (0)