From 378ddb69b18bf7e45d1420bc9bc2837f684a8e5e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 29 Apr 2024 10:23:08 +0200 Subject: [PATCH] better distinguish URL schemes and windows drive letters --- Path.php | 2 +- Tests/PathTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Path.php b/Path.php index 858e1623e..eb6d8ea08 100644 --- a/Path.php +++ b/Path.php @@ -368,7 +368,7 @@ public static function isAbsolute(string $path): bool } // Strip scheme - if (false !== $schemeSeparatorPosition = strpos($path, '://')) { + if (false !== ($schemeSeparatorPosition = strpos($path, '://')) && 1 !== $schemeSeparatorPosition) { $path = substr($path, $schemeSeparatorPosition + 3); } diff --git a/Tests/PathTest.php b/Tests/PathTest.php index 77b9f2a2d..17c6142c3 100644 --- a/Tests/PathTest.php +++ b/Tests/PathTest.php @@ -375,6 +375,8 @@ public static function provideIsAbsolutePathTests(): \Generator yield ['C:/css/style.css', true]; yield ['D:/', true]; + yield ['C:///windows', true]; + yield ['C://test', true]; yield ['E:\\css\\style.css', true]; yield ['F:\\', true];