diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 8e96f1a87da8b..96b5c02192375 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -172,7 +172,14 @@ public function remove($files) } } else { if (true !== @unlink($file)) { - throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file); + // handle broken symlinks on Windows systems + if (is_link($file) && false === @readlink($file)) { + if (true !== @rmdir($file)) { + throw new IOException(sprintf('Failed to remove broken symlink "%s".', $file), 0, null, $file); + } + } else { + throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file); + } } } }