[Filesystem] added workaround in Filesystem::rename for PHP bug

This commit is contained in:
VolCh 2017-06-07 14:57:47 +03:00 committed by Fabien Potencier
parent 62cbfdd2e2
commit 3ccbc479da
1 changed files with 7 additions and 0 deletions

View File

@ -276,6 +276,13 @@ class Filesystem
}
if (true !== @rename($origin, $target)) {
if (is_dir($origin)) {
// See https://bugs.php.net/bug.php?id=54097 & http://php.net/manual/en/function.rename.php#113943
$this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
$this->remove($origin);
return;
}
throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
}
}