@@ -29,26 +29,26 @@ var_dump($uri6->getHost());
2929
3030try {
3131 $ uri3 ->withHost ("test.com:8080 " );
32- } catch (Uri \ InvalidUriException $ e ) {
33- echo $ e ->getMessage () . "\n" ;
32+ } catch (Throwable $ e ) {
33+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
3434}
3535
3636try {
3737 $ uri3 ->withHost ("t%3As%2Ft.com " ); // t:s/t.com
38- } catch (Uri \ InvalidUriException $ e ) {
39- echo $ e ->getMessage () . "\n" ;
38+ } catch (Throwable $ e ) {
39+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
4040}
4141
4242try {
4343 $ uri3 ->withHost ("t:s/t.com " );
44- } catch (Uri \ InvalidUriException $ e ) {
45- echo $ e ->getMessage () . "\n" ;
44+ } catch (Throwable $ e ) {
45+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
4646}
4747
4848try {
4949 $ uri2 ->withHost ("" );
50- } catch (Uri \ InvalidUriException $ e ) {
51- echo $ e ->getMessage () . "\n" ;
50+ } catch (Throwable $ e ) {
51+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
5252}
5353
5454$ uri1 = Uri \Rfc3986 \Uri::parse ("ftp://user:pass@foo.com?query=abc#foo " );
@@ -59,8 +59,8 @@ var_dump($uri2->getHost());
5959
6060try {
6161 $ uri1 ->withHost (null );
62- } catch (Uri \ InvalidUriException $ e ) {
63- echo $ e ->getMessage () . "\n" ;
62+ } catch (Throwable $ e ) {
63+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
6464}
6565
6666$ url1 = Uri \WhatWg \Url::parse ("https://example.com " );
@@ -77,26 +77,26 @@ var_dump($url5->getAsciiHost());
7777
7878try {
7979 $ url3 ->withHost ("test.com:8080 " );
80- } catch (Uri \ WhatWg \ InvalidUrlException $ e ) {
81- echo $ e ->getMessage () . "\n" ;
80+ } catch (Throwable $ e ) {
81+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
8282}
8383
8484try {
8585 $ url3 ->withHost ("t%3As%2Ft.com " ); // t:s/t.com
86- } catch (Uri \ WhatWg \ InvalidUrlException $ e ) {
87- echo $ e ->getMessage () . "\n" ;
86+ } catch (Throwable $ e ) {
87+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
8888}
8989
9090try {
9191 $ url3 ->withHost ("t:s/t.com " ); // t:s/t.com
92- } catch (Uri \ WhatWg \ InvalidUrlException $ e ) {
93- echo $ e ->getMessage () . "\n" ;
92+ } catch (Throwable $ e ) {
93+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
9494}
9595
9696try {
9797 $ url2 ->withHost (null );
98- } catch (Uri \ WhatWg \ InvalidUrlException $ e ) {
99- echo $ e ->getMessage () . "\n" ;
98+ } catch (Throwable $ e ) {
99+ echo $ e::class, ' : ' , $ e ->getMessage (), "\n" ;
100100}
101101
102102$ url1 = Uri \WhatWg \Url::parse ("ftp://foo.com?query=abc#foo " );
@@ -119,19 +119,19 @@ string(11) "192.168.0.1"
119119string(11) "192.168.0.1"
120120string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]"
121121string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]"
122- The specified host is malformed
123- The specified host is malformed
122+ Uri\InvalidUriException: The specified host is malformed
123+ Uri\InvalidUriException: The specified host is malformed
124124string(7) "foo.com"
125125string(8) "test.com"
126- Cannot remove the host from a URI that has a userinfo
126+ Uri\InvalidUriException: Cannot remove the host from a URI that has a userinfo
127127string(11) "example.com"
128128string(8) "test.com"
129129string(8) "test.com"
130130string(11) "192.168.0.1"
131131string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]"
132- The specified host is malformed
133- The specified host is malformed (DomainInvalidCodePoint)
134- The specified host is malformed
135- The specified host is malformed (HostMissing)
132+ Uri\WhatWg\InvalidUrlException: The specified host is malformed
133+ Uri\WhatWg\InvalidUrlException: The specified host is malformed (DomainInvalidCodePoint)
134+ Uri\WhatWg\InvalidUrlException: The specified host is malformed
135+ Uri\WhatWg\InvalidUrlException: The specified host is malformed (HostMissing)
136136string(7) "foo.com"
137137string(8) "test.com"
0 commit comments