From f1b95d3c93f8de8e55e2d47e4c7a0e143fefe61d Mon Sep 17 00:00:00 2001 From: Roman Martinuk Date: Mon, 19 Apr 2021 15:15:09 +0300 Subject: [PATCH 1/2] [Filesystem] fix readlink for Windows --- src/Symfony/Component/Filesystem/Filesystem.php | 4 ++-- .../Component/Filesystem/Tests/FilesystemTest.php | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 483c0b4261..f8dbb983fc 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -416,14 +416,14 @@ class Filesystem 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/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 77f780127e..8d71de39a1 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -376,7 +376,7 @@ class FilesystemTest extends FilesystemTestCase // 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); @@ -1032,7 +1032,12 @@ class FilesystemTest extends FilesystemTestCase $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)); From c3ac11cc64ebd586cf224f6064e25e0ba271d0e9 Mon Sep 17 00:00:00 2001 From: "Antonin \"0x346e3730\" CLAUZIER" Date: Wed, 26 May 2021 12:28:46 +0200 Subject: [PATCH 2/2] [HttpKernel] Fixes tests for PHP7.4+ --- src/Symfony/Component/HttpKernel/HttpCache/Store.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 3b69289f17..7dfdc491dd 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -349,7 +349,7 @@ class Store implements StoreInterface { $path = $this->getPath($key); - return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null; + return file_exists($path) && false !== ($contents = @file_get_contents($path)) ? $contents : null; } /**