Skip to content

Commit b6c3d8d

Browse files
committed
FileSystem: prevents TypeError
1 parent 39864de commit b6c3d8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Utils/FileSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static function copy(string $source, string $dest, bool $overwrite = true
5858

5959
} else {
6060
static::createDir(dirname($dest));
61-
if (@stream_copy_to_stream(fopen($source, 'r'), fopen($dest, 'w')) === false) { // @ is escalated to exception
61+
if (($s = @fopen($source, 'r')) && ($d = @fopen($dest, 'w')) && @stream_copy_to_stream($s, $d) === false) { // @ is escalated to exception
6262
throw new Nette\IOException("Unable to copy file '$source' to '$dest'. " . self::getLastError());
6363
}
6464
}

0 commit comments

Comments
 (0)