Skip to content

Commit

Permalink
bug #54759 [Filesystem] better distinguish URL schemes and Windows dr…
Browse files Browse the repository at this point in the history
…ive letters (xabbuh)

This PR was merged into the 5.4 branch.

Discussion
----------

[Filesystem] better distinguish URL schemes and Windows drive letters

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #45485
| License       | MIT

Commits
-------

f456e75ec8 better distinguish URL schemes and windows drive letters
  • Loading branch information
fabpot committed May 1, 2024
2 parents 4eb063a + 378ddb6 commit ca1c224
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 ca1c224

Please sign in to comment.