[Filesystem] fix readlink for Windows
This commit is contained in:
parent
9b1e941fbe
commit
f1b95d3c93
@ -416,14 +416,14 @@ class Filesystem
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) {
|
||||||
$path = readlink($path);
|
$path = readlink($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return realpath($path);
|
return realpath($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
|
||||||
return realpath($path);
|
return realpath($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
|
|
||||||
// create symlink to nonexistent dir
|
// create symlink to nonexistent dir
|
||||||
rmdir($basePath.'dir');
|
rmdir($basePath.'dir');
|
||||||
$this->assertFalse('\\' === \DIRECTORY_SEPARATOR ? @readlink($basePath.'dir-link') : is_dir($basePath.'dir-link'));
|
$this->assertFalse('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400 ? @readlink($basePath.'dir-link') : is_dir($basePath.'dir-link'));
|
||||||
|
|
||||||
$this->filesystem->remove($basePath);
|
$this->filesystem->remove($basePath);
|
||||||
|
|
||||||
@ -1032,7 +1032,12 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
$this->filesystem->symlink($link1, $link2);
|
$this->filesystem->symlink($link1, $link2);
|
||||||
|
|
||||||
$this->assertEquals($file, $this->filesystem->readlink($link1));
|
$this->assertEquals($file, $this->filesystem->readlink($link1));
|
||||||
$this->assertEquals($link1, $this->filesystem->readlink($link2));
|
|
||||||
|
if (!('\\' == \DIRECTORY_SEPARATOR && \PHP_MAJOR_VERSION === 7 && \PHP_MINOR_VERSION === 3)) {
|
||||||
|
// Skip for Windows with PHP 7.3.*
|
||||||
|
$this->assertEquals($link1, $this->filesystem->readlink($link2));
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertEquals($file, $this->filesystem->readlink($link1, true));
|
$this->assertEquals($file, $this->filesystem->readlink($link1, true));
|
||||||
$this->assertEquals($file, $this->filesystem->readlink($link2, true));
|
$this->assertEquals($file, $this->filesystem->readlink($link2, true));
|
||||||
$this->assertEquals($file, $this->filesystem->readlink($file, true));
|
$this->assertEquals($file, $this->filesystem->readlink($file, true));
|
||||||
|
Reference in New Issue
Block a user