diff --git a/Filesystem.php b/Filesystem.php index 3498e7f9f..cf5f91538 100644 --- a/Filesystem.php +++ b/Filesystem.php @@ -399,14 +399,14 @@ public function readlink(string $path, bool $canonicalize = false) return null; } - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) { $path = readlink($path); } return realpath($path); } - if ('\\' === \DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) { return realpath($path); } diff --git a/Tests/FilesystemTest.php b/Tests/FilesystemTest.php index 4a1350de0..bedb2385e 100644 --- a/Tests/FilesystemTest.php +++ b/Tests/FilesystemTest.php @@ -376,7 +376,7 @@ public function testRemoveCleansInvalidLinks() // create symlink to nonexistent 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); @@ -1076,7 +1076,12 @@ public function testReadAbsoluteLink() $this->filesystem->symlink($link1, $link2); $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($link2, true)); $this->assertEquals($file, $this->filesystem->readlink($file, true));