Skip to content

Commit

Permalink
better distinguish URL schemes and windows drive letters
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Apr 29, 2024
1 parent e6edd87 commit 378ddb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/PathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 378ddb6

Please sign in to comment.