File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -351,9 +351,11 @@ public function isEqual($url): bool
351351 ksort ($ query );
352352 $ query2 = $ this ->query ;
353353 ksort ($ query2 );
354+ $ host = rtrim ($ url ->host , '. ' );
355+ $ host2 = rtrim ($ this ->host , '. ' );
354356 return $ url ->scheme === $ this ->scheme
355- && (!strcasecmp ($ url -> host , $ this -> host )
356- || self ::idnHostToUnicode ($ url -> host ) === self ::idnHostToUnicode ($ this -> host ))
357+ && (!strcasecmp ($ host , $ host2 )
358+ || self ::idnHostToUnicode ($ host ) === self ::idnHostToUnicode ($ host2 ))
357359 && $ url ->getPort () === $ this ->getPort ()
358360 && $ url ->user === $ this ->user
359361 && $ url ->password === $ this ->password
@@ -375,6 +377,7 @@ public function canonicalize()
375377 function (array $ m ): string { return rawurlencode ($ m [0 ]); },
376378 self ::unescape ($ this ->path , '%/ ' )
377379 );
380+ $ this ->host = rtrim ($ this ->host , '. ' );
378381 $ this ->host = self ::idnHostToUnicode (strtolower ($ this ->host ));
379382 return $ this ;
380383 }
Original file line number Diff line number Diff line change @@ -56,3 +56,10 @@ Assert::true($url->isEqual('http://example.com'));
5656
5757$ url = new Url ('https://xn--tst-qla.de/ ' );
5858Assert::true ($ url ->isEqual ('https://täst.de/ ' ));
59+
60+
61+ // dots at end
62+ $ url = new Url ('https://google.com./abcd ' );
63+ Assert::true ($ url ->isEqual ('https://google.com/abcd ' ));
64+ $ url = new Url ('https://xn--tst-qla.de./ ' );
65+ Assert::true ($ url ->isEqual ('https://täst.de/ ' ));
You can’t perform that action at this time.
0 commit comments