diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md index 96c170675c..9d6ad7b3dc 100644 --- a/UPGRADE-4.4.md +++ b/UPGRADE-4.4.md @@ -41,6 +41,11 @@ DependencyInjection arguments: [!tagged_iterator app.handler] ``` +Filesystem +---------- + + * Support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated. + Form ---- diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index bb6f87dd00..3d613e647d 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -135,6 +135,7 @@ EventDispatcher Filesystem ---------- + * The `Filesystem::isAbsolutePath()` method no longer supports `null` in the `$file` argument. * The `Filesystem::dumpFile()` method no longer supports arrays in the `$content` argument. * The `Filesystem::appendToFile()` method no longer supports arrays in the `$content` argument. diff --git a/src/Symfony/Component/Filesystem/CHANGELOG.md b/src/Symfony/Component/Filesystem/CHANGELOG.md index f6453c16e3..0b633ef2a7 100644 --- a/src/Symfony/Component/Filesystem/CHANGELOG.md +++ b/src/Symfony/Component/Filesystem/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +4.4.0 +----- + + * support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated and will be removed in 5.0 + 4.3.0 ----- diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index dd3d8b471e..969f5b05f9 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -600,6 +600,10 @@ class Filesystem */ public function isAbsolutePath($file) { + if (null === $file) { + @trigger_error(sprintf('Calling "%s()" with a null in the $file argument is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED); + } + return strspn($file, '/\\', 0, 1) || (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 7fa2ecd3de..80fb44ec34 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -1397,10 +1397,18 @@ class FilesystemTest extends FilesystemTestCase ['var/lib', false], ['../var/lib', false], ['', false], - [null, false], ]; } + /** + * @group legacy + * @expectedDeprecation Calling "Symfony\Component\Filesystem\Filesystem::isAbsolutePath()" with a null in the $file argument is deprecated since Symfony 4.4. + */ + public function testIsAbsolutePathWithNull() + { + $this->assertFalse($this->filesystem->isAbsolutePath(null)); + } + public function testTempnam() { $dirname = $this->workspace;