File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ Unreleased]
4+
5+ ### Fixed
6+
7+ - Detection of windows drive letters
8+
39## [ 3.1.6] - 2022-08-16
410
511### Changed
612
713- Forbid C0 control code points and U+007F DEL code point in non-opaque domain names per [ whatwg/url #685 ] ( https://github.com/whatwg/url/pull/685 )
14+
15+ ## Fixed
16+
817- Fix parsing IPv4-mapped IPv6 addresses due to wrong logical condition
918
1019## [ 3.1.5] - 2022-01-10
Original file line number Diff line number Diff line change 77use Rowbot \URL \String \AbstractStringBuffer ;
88use Rowbot \URL \String \CodePoint ;
99
10+ use function strlen ;
1011use function strpbrk ;
1112
1213/**
@@ -19,7 +20,7 @@ class Path extends AbstractStringBuffer
1920 */
2021 public function isNormalizedWindowsDriveLetter (): bool
2122 {
22- return isset ($ this ->string [ 1 ])
23+ return strlen ($ this ->string ) === 2
2324 && strpbrk ($ this ->string [0 ], CodePoint::ASCII_ALPHA_MASK ) === $ this ->string [0 ]
2425 && $ this ->string [1 ] === ': ' ;
2526 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Rowbot \URL \Tests ;
6+
7+ use PHPUnit \Framework \TestCase ;
8+ use Rowbot \URL \Component \Path ;
9+
10+ class PathTest extends TestCase
11+ {
12+ public function isNormalizedWindowsDriveLetterProvider (): array
13+ {
14+ return [
15+ ['c: ' , true ],
16+ ['c:/ ' , false ],
17+ ['c:a ' , false ],
18+ ['4: ' , false ],
19+ ['az: ' , false ],
20+ ['a| ' , false ],
21+ ['a:| ' , false ],
22+ ['' , false ],
23+ ['c: \\' , false ],
24+ ['c:? ' , false ],
25+ ['c:# ' , false ],
26+ ['c:/f ' , false ],
27+ ];
28+ }
29+
30+ /**
31+ * @dataProvider isNormalizedWindowsDriveLetterProvider
32+ */
33+ public function testIsNormalizedWindowsDriveLetter (string $ input , bool $ expected ): void
34+ {
35+ $ s = new Path ($ input );
36+ self ::assertSame ($ expected , $ s ->isNormalizedWindowsDriveLetter ());
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments