Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da924ab

Browse files
author
smoench
committed
[Filesystem] depreacte calling isAbsolutePath with a null
1 parent 64eaf7e commit da924ab

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ EventDispatcher
135135
Filesystem
136136
----------
137137

138+
* The `Filesystem::isAbsolutePath()` method no longer supports `null` in the `$file` argument.
138139
* The `Filesystem::dumpFile()` method no longer supports arrays in the `$content` argument.
139140
* The `Filesystem::appendToFile()` method no longer supports arrays in the `$content` argument.
140141

src/Symfony/Component/Filesystem/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.4.0
5+
-----
6+
7+
* support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated and will be removed in 5.0
8+
49
4.3.0
510
-----
611

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,10 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
600600
*/
601601
public function isAbsolutePath($file)
602602
{
603+
if (null === $file) {
604+
@trigger_error(sprintf('Calling "%s()" with a null in the $file argument is deprecated since Symfony 4.4.', __METHOD__), E_USER_DEPRECATED);
605+
}
606+
603607
return strspn($file, '/\\', 0, 1)
604608
|| (\strlen($file) > 3 && ctype_alpha($file[0])
605609
&& ':' === $file[1]

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1397,10 +1397,18 @@ public function providePathsForIsAbsolutePath()
13971397
['var/lib', false],
13981398
['../var/lib', false],
13991399
['', false],
1400-
[null, false],
14011400
];
14021401
}
14031402

1403+
/**
1404+
* @group legacy
1405+
* @expectedDeprecation Calling "Symfony\Component\Filesystem\Filesystem::isAbsolutePath()" with a null in the $file argument is deprecated since Symfony 4.4.
1406+
*/
1407+
public function testIsAbsolutePathWithNull()
1408+
{
1409+
$this->assertFalse($this->filesystem->isAbsolutePath(null));
1410+
}
1411+
14041412
public function testTempnam()
14051413
{
14061414
$dirname = $this->workspace;

0 commit comments

Comments
 (0)