File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4646 "psr-4" : {
4747 "Slim\\ Tests\\ Http\\ " : " tests/"
4848 }
49+ },
50+ "scripts" : {
51+ "test" : [
52+ " @phpunit" ,
53+ " @phpcs"
54+ ],
55+ "phpunit" : " php vendor/bin/phpunit" ,
56+ "phpcs" : " php vendor/bin/phpcs"
4957 }
5058}
Original file line number Diff line number Diff line change @@ -768,8 +768,8 @@ public function __toString()
768768
769769 $ path = '/ ' . ltrim ($ path , '/ ' );
770770
771- return ($ scheme ? $ scheme . ': ' : '' )
772- . ($ authority ? '// ' . $ authority : '' )
771+ return ($ scheme !== '' ? $ scheme . ': ' : '' )
772+ . ($ authority !== '' ? '// ' . $ authority : '' )
773773 . $ path
774774 . ($ query !== '' ? '? ' . $ query : '' )
775775 . ($ fragment !== '' ? '# ' . $ fragment : '' );
@@ -789,7 +789,7 @@ public function getBaseUrl()
789789 $ scheme = $ this ->getScheme ();
790790 $ authority = $ this ->getAuthority ();
791791
792- return ($ scheme ? $ scheme . ': ' : '' )
793- . ($ authority ? '// ' . $ authority : '' );
792+ return ($ scheme !== '' ? $ scheme . ': ' : '' )
793+ . ($ authority !== '' ? '// ' . $ authority : '' );
794794 }
795795}
Original file line number Diff line number Diff line change @@ -597,4 +597,16 @@ public function testRequestURICanContainParams()
597597 );
598598 $ this ->assertEquals ('abc=123 ' , $ uri ->getQuery ());
599599 }
600+
601+ public function testUriDistinguishZeroFromEmptyString ()
602+ {
603+ $ expected = 'https://0:0@0:1/0?0#0 ' ;
604+ $ this ->assertSame ($ expected , (string ) Uri::createFromString ($ expected ));
605+ }
606+
607+ public function testGetBaseUrlDistinguishZeroFromEmptyString ()
608+ {
609+ $ expected = 'https://0:0@0:1/0?0#0 ' ;
610+ $ this ->assertSame ('https://0:0@0:1 ' , (string ) Uri::createFromString ($ expected )->getBaseUrl ());
611+ }
600612}
You can’t perform that action at this time.
0 commit comments