Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit ece32a1

Browse files
committed
Update class.AbstractAccessDriver.php
Problem when cross copying empty files (i.e. created in Pydio with the menu entry 'Create'), when the default filecopy function is used (i.e. copying from dropbox to ftp...) - symptom: the file is not copied, there is an infinite loop, the condition on feof never breaks the loop. - reason: feof always (in php at least) return 0 when the file size is 0, because an end of file is never reached - solution: do not use feof to control the loop, or break when there is nothing more to copy.
1 parent fcf6c1f commit ece32a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/plugins/core.access/class.AbstractAccessDriver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ protected function filecopy($srcFile, $destFile, $srcWrapperName, $destWrapperNa
314314
$dest = fopen($destFile, "w");
315315
if ($dest !== false) {
316316
while (!feof($src)) {
317-
stream_copy_to_stream($src, $dest, 4096);
317+
//stream_copy_to_stream($src, $dest, 4096);
318+
$count = stream_copy_to_stream($src, $dest, 4096);
319+
if ($count == 0) break;
318320
}
319321
fclose($dest);
320322
}

0 commit comments

Comments
 (0)