diff --git a/ext/uri/tests/004.phpt b/ext/uri/tests/004.phpt index a7c2e190683a..c6ad96ce99a7 100644 --- a/ext/uri/tests/004.phpt +++ b/ext/uri/tests/004.phpt @@ -8,8 +8,8 @@ var_dump(Uri\Rfc3986\Uri::parse("")); try { new Uri\WhatWg\Url(""); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump(Uri\WhatWg\Url::parse("")); @@ -58,7 +58,7 @@ object(Uri\Rfc3986\Uri)#%d (%d) { ["fragment"]=> NULL } -The specified URI is malformed (MissingSchemeNonRelativeUrl) +Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl) NULL object(Uri\Rfc3986\Uri)#%d (%d) { ["scheme"]=> diff --git a/ext/uri/tests/007.phpt b/ext/uri/tests/007.phpt index db051e553fb1..9d2f389e2513 100644 --- a/ext/uri/tests/007.phpt +++ b/ext/uri/tests/007.phpt @@ -5,14 +5,14 @@ Test URI creation errors try { new Uri\Rfc3986\Uri("https://example.com:8080@username:password/path?q=r#fragment"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new Uri\WhatWg\Url("https://example.com:8080@username:password/path?q=r#fragment"); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->errors); } @@ -23,8 +23,8 @@ var_dump($failures); ?> --EXPECTF-- -The specified URI is malformed -The specified URI is malformed (PortInvalid) +Uri\InvalidUriException: The specified URI is malformed +Uri\WhatWg\InvalidUrlException: The specified URI is malformed (PortInvalid) array(%d) { [0]=> object(Uri\WhatWg\UrlValidationError)#%d (%d) { diff --git a/ext/uri/tests/015.phpt b/ext/uri/tests/015.phpt index cf6c09703d2e..e3a846f5e314 100644 --- a/ext/uri/tests/015.phpt +++ b/ext/uri/tests/015.phpt @@ -9,18 +9,18 @@ uri try { $reflectionClass = new ReflectionClass(Uri\Rfc3986\Uri::class); $reflectionClass->newInstanceWithoutConstructor(); -} catch (ReflectionException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $reflectionClass = new ReflectionClass(Uri\WhatWg\Url::class); $reflectionClass->newInstanceWithoutConstructor(); -} catch (ReflectionException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Class Uri\Rfc3986\Uri is an internal class marked as final that cannot be instantiated without invoking its constructor -Class Uri\WhatWg\Url is an internal class marked as final that cannot be instantiated without invoking its constructor +ReflectionException: Class Uri\Rfc3986\Uri is an internal class marked as final that cannot be instantiated without invoking its constructor +ReflectionException: Class Uri\WhatWg\Url is an internal class marked as final that cannot be instantiated without invoking its constructor diff --git a/ext/uri/tests/023.phpt b/ext/uri/tests/023.phpt index d52fa3405322..8899abc16b6c 100644 --- a/ext/uri/tests/023.phpt +++ b/ext/uri/tests/023.phpt @@ -17,14 +17,14 @@ var_dump($uri3->getScheme()); try { $uri3->withScheme(""); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withScheme("http%73"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("https://example.com"); @@ -35,14 +35,14 @@ var_dump($url2->getScheme()); try { $url2->withScheme(""); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url2->withScheme("http%73"); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -53,9 +53,9 @@ string(4) "http" string(4) "http" NULL NULL -The specified scheme is malformed -The specified scheme is malformed +Uri\InvalidUriException: The specified scheme is malformed +Uri\InvalidUriException: The specified scheme is malformed string(5) "https" string(4) "http" -The specified scheme is malformed -The specified scheme is malformed +Uri\WhatWg\InvalidUrlException: The specified scheme is malformed +Uri\WhatWg\InvalidUrlException: The specified scheme is malformed diff --git a/ext/uri/tests/026.phpt b/ext/uri/tests/026.phpt index e46c30055cb6..179b00d38572 100644 --- a/ext/uri/tests/026.phpt +++ b/ext/uri/tests/026.phpt @@ -29,26 +29,26 @@ var_dump($uri6->getHost()); try { $uri3->withHost("test.com:8080"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withHost("t%3As%2Ft.com"); // t:s/t.com -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withHost("t:s/t.com"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri2->withHost(""); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $uri1 = Uri\Rfc3986\Uri::parse("ftp://user:pass@foo.com?query=abc#foo"); @@ -59,8 +59,8 @@ var_dump($uri2->getHost()); try { $uri1->withHost(null); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("https://example.com"); @@ -77,26 +77,26 @@ var_dump($url5->getAsciiHost()); try { $url3->withHost("test.com:8080"); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url3->withHost("t%3As%2Ft.com"); // t:s/t.com -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url3->withHost("t:s/t.com"); // t:s/t.com -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url2->withHost(null); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("ftp://foo.com?query=abc#foo"); @@ -119,19 +119,19 @@ string(11) "192.168.0.1" string(11) "192.168.0.1" string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]" string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]" -The specified host is malformed -The specified host is malformed +Uri\InvalidUriException: The specified host is malformed +Uri\InvalidUriException: The specified host is malformed string(7) "foo.com" string(8) "test.com" -Cannot remove the host from a URI that has a userinfo +Uri\InvalidUriException: Cannot remove the host from a URI that has a userinfo string(11) "example.com" string(8) "test.com" string(8) "test.com" string(11) "192.168.0.1" string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]" -The specified host is malformed -The specified host is malformed (DomainInvalidCodePoint) -The specified host is malformed -The specified host is malformed (HostMissing) +Uri\WhatWg\InvalidUrlException: The specified host is malformed +Uri\WhatWg\InvalidUrlException: The specified host is malformed (DomainInvalidCodePoint) +Uri\WhatWg\InvalidUrlException: The specified host is malformed +Uri\WhatWg\InvalidUrlException: The specified host is malformed (HostMissing) string(7) "foo.com" string(8) "test.com" diff --git a/ext/uri/tests/026_userinfo.phpt b/ext/uri/tests/026_userinfo.phpt index cff2665803a4..a29abddf9720 100644 --- a/ext/uri/tests/026_userinfo.phpt +++ b/ext/uri/tests/026_userinfo.phpt @@ -25,8 +25,8 @@ var_dump($uri2->getPort()); try { $uri4->withUserInfo("u:s/r"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $uri5 = Uri\Rfc3986\Uri::parse("file:///foo/bar/"); @@ -46,6 +46,6 @@ NULL string(13) "%75s%2Fr:pass" string(11) "us%2Fr:pass" NULL -The specified userinfo is malformed +Uri\InvalidUriException: The specified userinfo is malformed NULL string(9) "user:pass" diff --git a/ext/uri/tests/027.phpt b/ext/uri/tests/027.phpt index 334d67aa0bb6..2309cace93d9 100644 --- a/ext/uri/tests/027.phpt +++ b/ext/uri/tests/027.phpt @@ -29,8 +29,8 @@ var_dump($uri2->getPort()); try { $uri1->withPort(1); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("https://example.com:8080"); @@ -63,7 +63,7 @@ int(8080) NULL int(80) NULL -Cannot set a port without having a host +Uri\InvalidUriException: Cannot set a port without having a host int(8080) int(22) NULL diff --git a/ext/uri/tests/028.phpt b/ext/uri/tests/028.phpt index cfc11b331c8e..708a50d4f2ec 100644 --- a/ext/uri/tests/028.phpt +++ b/ext/uri/tests/028.phpt @@ -25,14 +25,14 @@ var_dump($uri5->getPath()); try { $uri5->withPath("test"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri5->withPath("/#"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $uri1 = Uri\Rfc3986\Uri::parse("/foo"); @@ -73,8 +73,8 @@ string(10) "/foo%2Fbar" string(10) "/foo%2Fbar" string(0) "" string(0) "" -The specified path is malformed -The specified path is malformed +Uri\InvalidUriException: The specified path is malformed +Uri\InvalidUriException: The specified path is malformed string(4) "/foo" string(3) "bar" string(9) "/foo/bar/" diff --git a/ext/uri/tests/029.phpt b/ext/uri/tests/029.phpt index 4936cb60db87..c1ce0e10d94c 100644 --- a/ext/uri/tests/029.phpt +++ b/ext/uri/tests/029.phpt @@ -37,8 +37,8 @@ var_dump($uri5->getQuery()); try { $uri5->withQuery("#"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("https://example.com?foo=bar"); @@ -81,7 +81,7 @@ string(6) "t%65st" string(4) "test" string(25) "foo=foo%26bar&baz=/qux%3D" string(25) "foo=foo%26bar&baz=/qux%3D" -The specified query is malformed +Uri\InvalidUriException: The specified query is malformed string(7) "foo=bar" string(7) "foo=baz" NULL diff --git a/ext/uri/tests/030.phpt b/ext/uri/tests/030.phpt index 03ed763f7795..e3df0f939980 100644 --- a/ext/uri/tests/030.phpt +++ b/ext/uri/tests/030.phpt @@ -17,14 +17,14 @@ var_dump($uri3->getFragment()); try { $uri3->withFragment(" "); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri1->withFragment("#fragment2"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $uri1 = Uri\Rfc3986\Uri::parse("https://example.com?abc=def"); @@ -57,8 +57,8 @@ string(9) "fragment2" string(9) "fragment2" NULL NULL -The specified fragment is malformed -The specified fragment is malformed +Uri\InvalidUriException: The specified fragment is malformed +Uri\InvalidUriException: The specified fragment is malformed NULL string(8) "fragment" string(9) "fragment1" diff --git a/ext/uri/tests/031.phpt b/ext/uri/tests/031.phpt index d3cc926b82fa..d60190457c1e 100644 --- a/ext/uri/tests/031.phpt +++ b/ext/uri/tests/031.phpt @@ -12,50 +12,50 @@ var_dump($uri2); try { unserialize('O:15:"Uri\Rfc3986\Uri":1:{i:0;a:0:{}}'); // less than 2 items -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":3:{i:0;a:0:{}i:1;a:0:{}i:2;a:0:{}}'); // more than 2 items -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":2:{i:0;N;i:1;a:0:{}}'); // first item is not an array -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":2:{i:0;a:0:{}i:1;a:0:{}}'); // first array is empty -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":2:{i:0;a:1:{s:3:"uri";i:1;}i:1;a:0:{}}'); // "uri" key in first array is not a string -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":2:{i:0;a:1:{s:3:"uri";s:2:"%1";}i:1;a:0:{}}'); // "uri" key in first array contains invalid URI -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":2:{i:0;a:1:{s:3:"uri";s:4:"/uri";}i:1;s:0:"";}'); // second item in not an array -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:15:"Uri\Rfc3986\Uri":2:{i:0;a:1:{s:3:"uri";s:4:"/uri";}i:1;a:1:{s:5:"prop1";i:123;}}'); // second array contains a property -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = new Uri\WhatWg\Url("https://username:password@www.example.com:8080/pathname1/pathname2/pathname3?query=true#hash-exists"); @@ -67,56 +67,56 @@ var_dump($url2); try { unserialize('O:14:"Uri\WhatWg\Url":1:{i:0;a:0:{}}'); // less than 2 items -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":3:{i:0;a:0:{}i:1;a:0:{}i:2;a:0:{}}'); // more than 2 items -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;N;i:1;a:0:{}}'); // first item is not an array -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;a:0:{}i:1;a:0:{}}'); // first array is empty -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;a:2:{s:3:"uri";s:19:"https://example.com";s:1:"a";i:1;}i:1;a:0:{}}'); // "uri" key in first array contains more than 1 item -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;a:1:{s:3:"uri";i:1;}i:1;a:0:{}}'); // "uri" key in first array is not a string -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;a:1:{s:3:"uri";s:11:"invalid-url";}i:1;a:0:{}}'); // "uri" key in first array contains invalid URL -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;a:1:{s:3:"uri";s:19:"https://example.com";}i:1;s:0:"";}'); // second item in not an array -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { unserialize('O:14:"Uri\WhatWg\Url":2:{i:0;a:1:{s:3:"uri";s:19:"https://example.com";}i:1;a:1:{s:5:"prop1";i:123;}}'); // second array contains property -} catch (Exception $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> @@ -140,14 +140,14 @@ object(Uri\Rfc3986\Uri)#%d (%d) { ["fragment"]=> string(11) "hash-exists" } -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object -Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object +Exception: Invalid serialization data for Uri\Rfc3986\Uri object string(163) "O:14:"Uri\WhatWg\Url":2:{i:0;a:1:{s:3:"uri";s:99:"https://username:password@www.example.com:8080/pathname1/pathname2/pathname3?query=true#hash-exists";}i:1;a:0:{}}" object(Uri\WhatWg\Url)#%d (%d) { ["scheme"]=> @@ -167,12 +167,12 @@ object(Uri\WhatWg\Url)#%d (%d) { ["fragment"]=> string(11) "hash-exists" } -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object -Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object +Exception: Invalid serialization data for Uri\WhatWg\Url object diff --git a/ext/uri/tests/051.phpt b/ext/uri/tests/051.phpt index 0485356075a8..cb9c975d2385 100644 --- a/ext/uri/tests/051.phpt +++ b/ext/uri/tests/051.phpt @@ -7,16 +7,16 @@ $uri = new Uri\Rfc3986\Uri("https://example.com"); try { $uri->resolve("รก"); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $url = new Uri\WhatWg\Url("https://example.com"); try { $url->resolve("https://1.2.3.4.5"); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } $softErrors = []; @@ -26,8 +26,8 @@ var_dump($softErrors); ?> --EXPECTF-- -The specified URI is malformed -The specified URI is malformed (Ipv4TooManyParts) +Uri\InvalidUriException: The specified URI is malformed +Uri\WhatWg\InvalidUrlException: The specified URI is malformed (Ipv4TooManyParts) string(23) "https://example.com/foo" array(%d) { [0]=> diff --git a/ext/uri/tests/052.phpt b/ext/uri/tests/052.phpt index 3d8d2053f6e8..b0867b02bd5a 100644 --- a/ext/uri/tests/052.phpt +++ b/ext/uri/tests/052.phpt @@ -7,15 +7,15 @@ $r = new Uri\WhatWg\UrlValidationError('foo', Uri\WhatWg\UrlValidationErrorType: try { $r->__construct('bar', Uri\WhatWg\UrlValidationErrorType::HostMissing, false); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($r); ?> --EXPECTF-- -Cannot modify readonly property Uri\WhatWg\UrlValidationError::$context +Error: Cannot modify readonly property Uri\WhatWg\UrlValidationError::$context object(Uri\WhatWg\UrlValidationError)#%d (%d) { ["context"]=> string(3) "foo" diff --git a/ext/uri/tests/053.phpt b/ext/uri/tests/053.phpt index c88f4d386f35..7f68772e5487 100644 --- a/ext/uri/tests/053.phpt +++ b/ext/uri/tests/053.phpt @@ -12,26 +12,26 @@ $r = new Uri\WhatWg\InvalidUrlException( try { $r->__construct("foo"); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("bar", []); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("baz", [], 0); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("qax", [], 0, null); -} catch (Error $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } var_dump($r->getMessage()); @@ -41,10 +41,10 @@ var_dump($r->getPrevious()::class); ?> --EXPECTF-- -Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors -Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors -Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors -Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors +Error: Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors +Error: Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors +Error: Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors +Error: Cannot modify readonly property Uri\WhatWg\InvalidUrlException::$errors string(3) "qax" array(%d) { [%d]=> diff --git a/ext/uri/tests/054.phpt b/ext/uri/tests/054.phpt index 757b21cc114a..386f88ae93e5 100644 --- a/ext/uri/tests/054.phpt +++ b/ext/uri/tests/054.phpt @@ -5,12 +5,12 @@ Test UrlValidationErrorType singleton try { new \Uri\WhatWg\Url('http://localhost:99999'); -} catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->errors[0]->type === \Uri\WhatWg\UrlValidationErrorType::PortOutOfRange); } ?> --EXPECT-- -The specified URI is malformed (PortOutOfRange) +Uri\WhatWg\InvalidUrlException: The specified URI is malformed (PortOutOfRange) bool(true) diff --git a/ext/uri/tests/055.phpt b/ext/uri/tests/055.phpt index de240bb6e053..fddb313149df 100644 --- a/ext/uri/tests/055.phpt +++ b/ext/uri/tests/055.phpt @@ -5,9 +5,9 @@ Test InvalidUrlException constructor error handling try { var_dump(new Uri\Rfc3986\Uri('foo', new Uri\Rfc3986\Uri('bar'))); -} catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -The specified base URI must be absolute +Uri\InvalidUriException: The specified base URI must be absolute diff --git a/ext/uri/tests/101.phpt b/ext/uri/tests/101.phpt index daa83e45c9f8..b00eeac8f804 100644 --- a/ext/uri/tests/101.phpt +++ b/ext/uri/tests/101.phpt @@ -7,14 +7,14 @@ zend_test try { var_dump(zend_test_uri_parser('invalid uri', "Uri\\WhatWg\\Url")); -} catch (\Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage(), PHP_EOL; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; var_dump($e->errors); } ?> --EXPECTF-- -The specified URI is malformed (MissingSchemeNonRelativeUrl) +Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl) array(1) { [0]=> object(Uri\WhatWg\UrlValidationError)#%d (3) { diff --git a/ext/uri/tests/gh19780.phpt b/ext/uri/tests/gh19780.phpt index fffa25bc37d2..24a3fed9e2a6 100644 --- a/ext/uri/tests/gh19780.phpt +++ b/ext/uri/tests/gh19780.phpt @@ -9,19 +9,19 @@ use Uri\WhatWg\UrlValidationErrorType; try { new InvalidUrlException('message', ['foo']); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } try { new InvalidUrlException('message', [ 1 => new UrlValidationError('context', UrlValidationErrorType::HostMissing, true) ]); -} catch (ValueError $e) { - echo $e->getMessage(), "\n"; +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- -Uri\WhatWg\InvalidUrlException::__construct(): Argument #2 ($errors) must be a list of Uri\WhatWg\UrlValidationError -Uri\WhatWg\InvalidUrlException::__construct(): Argument #2 ($errors) must be a list of Uri\WhatWg\UrlValidationError +ValueError: Uri\WhatWg\InvalidUrlException::__construct(): Argument #2 ($errors) must be a list of Uri\WhatWg\UrlValidationError +ValueError: Uri\WhatWg\InvalidUrlException::__construct(): Argument #2 ($errors) must be a list of Uri\WhatWg\UrlValidationError