Skip to content

Commit e37bdf0

Browse files
bug symfony#58713 [Config] Handle Phar absolute path in FileLocator (alexandre-daubois)
This PR was merged into the 5.4 branch. Discussion ---------- [Config] Handle Phar absolute path in `FileLocator` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#58708 | License | MIT Commits ------- 4f00d6f [Config] Handle Phar absolute path in `FileLocator`
2 parents 454c49b + 4f00d6f commit e37bdf0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Symfony/Component/Config/FileLocator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ private function isAbsolutePath(string $file): bool
8585
&& ('\\' === $file[2] || '/' === $file[2])
8686
)
8787
|| parse_url($file, \PHP_URL_SCHEME)
88+
|| str_starts_with($file, 'phar:///') // "parse_url()" doesn't handle absolute phar path, despite being valid
8889
) {
8990
return true;
9091
}

src/Symfony/Component/Config/Tests/FileLocatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static function getIsAbsolutePathTests(): array
3939
['\\server\\foo.xml'],
4040
['https://server/foo.xml'],
4141
['phar://server/foo.xml'],
42+
['phar:///server/foo.xml'],
4243
];
4344
}
4445

0 commit comments

Comments
 (0)