Skip to content

Commit ca1c224

Browse files
committed
bug #54759 [Filesystem] better distinguish URL schemes and Windows drive 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
2 parents 4eb063a + 378ddb6 commit ca1c224

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Path.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static function isAbsolute(string $path): bool
368368
}
369369

370370
// Strip scheme
371-
if (false !== $schemeSeparatorPosition = strpos($path, '://')) {
371+
if (false !== ($schemeSeparatorPosition = strpos($path, '://')) && 1 !== $schemeSeparatorPosition) {
372372
$path = substr($path, $schemeSeparatorPosition + 3);
373373
}
374374

Tests/PathTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ public static function provideIsAbsolutePathTests(): \Generator
375375

376376
yield ['C:/css/style.css', true];
377377
yield ['D:/', true];
378+
yield ['C:///windows', true];
379+
yield ['C://test', true];
378380

379381
yield ['E:\\css\\style.css', true];
380382
yield ['F:\\', true];

0 commit comments

Comments
 (0)