Skip to content

Commit c056a9c

Browse files
Damian Sromekfabpot
authored andcommitted
[Filesystem] Add FTP stream wrapper context option to enable overwrite (override)
1 parent 2c9496b commit c056a9c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public function copy($originFile, $targetFile, $override = false)
5050
if ($doCopy) {
5151
// https://bugs.php.net/bug.php?id=64634
5252
$source = fopen($originFile, 'r');
53-
$target = fopen($targetFile, 'w');
53+
// Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default
54+
$target = fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))));
5455
stream_copy_to_stream($source, $target);
5556
fclose($source);
5657
fclose($target);

0 commit comments

Comments
 (0)