Update v1.0.6.5
This commit is contained in:
24
vendor/symfony/filesystem/Filesystem.php
vendored
24
vendor/symfony/filesystem/Filesystem.php
vendored
@@ -115,6 +115,10 @@ class Filesystem
|
||||
public function exists($files)
|
||||
{
|
||||
foreach ($this->toIterator($files) as $file) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && strlen($file) > 258) {
|
||||
throw new IOException('Could not check if file exist because path length exceeds 258 characters.', 0, null, $file);
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
@@ -154,7 +158,7 @@ class Filesystem
|
||||
$files = iterator_to_array($this->toIterator($files));
|
||||
$files = array_reverse($files);
|
||||
foreach ($files as $file) {
|
||||
if (!file_exists($file) && !is_link($file)) {
|
||||
if (!$this->exists($file) && !is_link($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -268,7 +272,7 @@ class Filesystem
|
||||
public function rename($origin, $target, $overwrite = false)
|
||||
{
|
||||
// we check that target does not exist
|
||||
if (!$overwrite && is_readable($target)) {
|
||||
if (!$overwrite && $this->isReadable($target)) {
|
||||
throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
|
||||
}
|
||||
|
||||
@@ -277,6 +281,22 @@ class Filesystem
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether a file exists and is readable.
|
||||
*
|
||||
* @param string $filename Path to the file.
|
||||
*
|
||||
* @throws IOException When windows path is longer than 258 characters
|
||||
*/
|
||||
private function isReadable($filename)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && strlen($filename) > 258) {
|
||||
throw new IOException('Could not check if file is readable because path length exceeds 258 characters.', 0, null, $filename);
|
||||
}
|
||||
|
||||
return is_readable($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a symbolic link or copy a directory.
|
||||
*
|
||||
|
Reference in New Issue
Block a user