From 977c88a02d7d3f16904a81907531b19666a08e78 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 30 Oct 2024 08:58:02 +0100 Subject: [PATCH] [Config] Handle Phar absolute path in `FileLocator` --- FileLocator.php | 1 + Tests/FileLocatorTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/FileLocator.php b/FileLocator.php index 95446498d..80268737c 100644 --- a/FileLocator.php +++ b/FileLocator.php @@ -85,6 +85,7 @@ private function isAbsolutePath(string $file): bool && ('\\' === $file[2] || '/' === $file[2]) ) || parse_url($file, \PHP_URL_SCHEME) + || str_starts_with($file, 'phar:///') // "parse_url()" doesn't handle absolute phar path, despite being valid ) { return true; } diff --git a/Tests/FileLocatorTest.php b/Tests/FileLocatorTest.php index 7a6ea6bf3..836d06abc 100644 --- a/Tests/FileLocatorTest.php +++ b/Tests/FileLocatorTest.php @@ -39,6 +39,7 @@ public static function getIsAbsolutePathTests(): array ['\\server\\foo.xml'], ['https://server/foo.xml'], ['phar://server/foo.xml'], + ['phar:///server/foo.xml'], ]; }