Skip to content

Commit 802dc1b

Browse files
committed
minor #32315 [Filesystem] deprecate calling isAbsolutePath with a null (smoench)
This PR was merged into the 4.4 branch. Discussion ---------- [Filesystem] deprecate calling isAbsolutePath with a null | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | N/A <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A This PR is a result of #32247 and deprecates calling `Filesystem::isAbsolutePath()` with a `null` value. Commits ------- 9319018 [Filesystem] depreacte calling isAbsolutePath with a null
2 parents c3e914c + 9319018 commit 802dc1b

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

UPGRADE-4.4.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ DependencyInjection
4141
arguments: [!tagged_iterator app.handler]
4242
```
4343

44+
Filesystem
45+
----------
46+
47+
* Support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated.
48+
4449
Form
4550
----
4651

UPGRADE-5.0.md

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

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

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy