From e3d68a93d229c59784cec19285a6d0f4105e4929 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Fri, 7 Aug 2026 15:15:32 +0000 Subject: [PATCH 1/2] ext/uri: applied fixers to improve test robustness --- ext/uri/tests/004.phpt | 4 +- ext/uri/tests/007.phpt | 8 ++-- ext/uri/tests/015.phpt | 8 ++-- ext/uri/tests/023.phpt | 16 ++++---- ext/uri/tests/026.phpt | 32 ++++++++-------- ext/uri/tests/026_userinfo.phpt | 4 +- ext/uri/tests/027.phpt | 4 +- ext/uri/tests/028.phpt | 8 ++-- ext/uri/tests/029.phpt | 4 +- ext/uri/tests/030.phpt | 8 ++-- ext/uri/tests/031.phpt | 68 ++++++++++++++++----------------- ext/uri/tests/051.phpt | 8 ++-- ext/uri/tests/052.phpt | 4 +- ext/uri/tests/053.phpt | 16 ++++---- ext/uri/tests/054.phpt | 4 +- ext/uri/tests/055.phpt | 4 +- ext/uri/tests/101.phpt | 4 +- ext/uri/tests/gh19780.phpt | 8 ++-- 18 files changed, 106 insertions(+), 106 deletions(-) diff --git a/ext/uri/tests/004.phpt b/ext/uri/tests/004.phpt index a7c2e190683a..9a47ac9a8d91 100644 --- a/ext/uri/tests/004.phpt +++ b/ext/uri/tests/004.phpt @@ -9,7 +9,7 @@ var_dump(Uri\Rfc3986\Uri::parse("")); try { new Uri\WhatWg\Url(""); } catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; + 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..d17f53e2f2b2 100644 --- a/ext/uri/tests/007.phpt +++ b/ext/uri/tests/007.phpt @@ -6,13 +6,13 @@ 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"; + 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"; + 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..7f04b4ada0bc 100644 --- a/ext/uri/tests/015.phpt +++ b/ext/uri/tests/015.phpt @@ -10,17 +10,17 @@ try { $reflectionClass = new ReflectionClass(Uri\Rfc3986\Uri::class); $reflectionClass->newInstanceWithoutConstructor(); } catch (ReflectionException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $reflectionClass = new ReflectionClass(Uri\WhatWg\Url::class); $reflectionClass->newInstanceWithoutConstructor(); } catch (ReflectionException $e) { - echo $e->getMessage() . "\n"; + 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..7ecea0b1414a 100644 --- a/ext/uri/tests/023.phpt +++ b/ext/uri/tests/023.phpt @@ -18,13 +18,13 @@ var_dump($uri3->getScheme()); try { $uri3->withScheme(""); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withScheme("http%73"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("https://example.com"); @@ -36,13 +36,13 @@ var_dump($url2->getScheme()); try { $url2->withScheme(""); } catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url2->withScheme("http%73"); } catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; + 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..64205aa82d05 100644 --- a/ext/uri/tests/026.phpt +++ b/ext/uri/tests/026.phpt @@ -30,25 +30,25 @@ var_dump($uri6->getHost()); try { $uri3->withHost("test.com:8080"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + 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"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withHost("t:s/t.com"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri2->withHost(""); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $uri1 = Uri\Rfc3986\Uri::parse("ftp://user:pass@foo.com?query=abc#foo"); @@ -60,7 +60,7 @@ var_dump($uri2->getHost()); try { $uri1->withHost(null); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $url1 = Uri\WhatWg\Url::parse("https://example.com"); @@ -78,25 +78,25 @@ var_dump($url5->getAsciiHost()); try { $url3->withHost("test.com:8080"); } catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; + 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"; + 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"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url2->withHost(null); } catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; + 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..4c7edfd5eb0d 100644 --- a/ext/uri/tests/026_userinfo.phpt +++ b/ext/uri/tests/026_userinfo.phpt @@ -26,7 +26,7 @@ var_dump($uri2->getPort()); try { $uri4->withUserInfo("u:s/r"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + 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..ea5d96f95292 100644 --- a/ext/uri/tests/027.phpt +++ b/ext/uri/tests/027.phpt @@ -30,7 +30,7 @@ var_dump($uri2->getPort()); try { $uri1->withPort(1); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + 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..f3806c1ed2ab 100644 --- a/ext/uri/tests/028.phpt +++ b/ext/uri/tests/028.phpt @@ -26,13 +26,13 @@ var_dump($uri5->getPath()); try { $uri5->withPath("test"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri5->withPath("/#"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + 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..8bb0158090e7 100644 --- a/ext/uri/tests/029.phpt +++ b/ext/uri/tests/029.phpt @@ -38,7 +38,7 @@ var_dump($uri5->getQuery()); try { $uri5->withQuery("#"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + 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..8912cf096ac4 100644 --- a/ext/uri/tests/030.phpt +++ b/ext/uri/tests/030.phpt @@ -18,13 +18,13 @@ var_dump($uri3->getFragment()); try { $uri3->withFragment(" "); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri1->withFragment("#fragment2"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + 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..e7454a7d7f79 100644 --- a/ext/uri/tests/031.phpt +++ b/ext/uri/tests/031.phpt @@ -13,49 +13,49 @@ 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"); @@ -68,55 +68,55 @@ 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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"; + 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..722254e059ec 100644 --- a/ext/uri/tests/051.phpt +++ b/ext/uri/tests/051.phpt @@ -8,7 +8,7 @@ $uri = new Uri\Rfc3986\Uri("https://example.com"); try { $uri->resolve("á"); } catch (Uri\InvalidUriException $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } $url = new Uri\WhatWg\Url("https://example.com"); @@ -16,7 +16,7 @@ $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"; + 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..fbe1cc90558b 100644 --- a/ext/uri/tests/052.phpt +++ b/ext/uri/tests/052.phpt @@ -8,14 +8,14 @@ $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"; + 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..c077c68452fc 100644 --- a/ext/uri/tests/053.phpt +++ b/ext/uri/tests/053.phpt @@ -13,25 +13,25 @@ $r = new Uri\WhatWg\InvalidUrlException( try { $r->__construct("foo"); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("bar", []); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("baz", [], 0); } catch (Error $e) { - echo $e->getMessage() . "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("qax", [], 0, null); } catch (Error $e) { - echo $e->getMessage() . "\n"; + 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..b8670395162f 100644 --- a/ext/uri/tests/054.phpt +++ b/ext/uri/tests/054.phpt @@ -6,11 +6,11 @@ Test UrlValidationErrorType singleton try { new \Uri\WhatWg\Url('http://localhost:99999'); } catch (Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage() . "\n"; + 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..1b2349142352 100644 --- a/ext/uri/tests/055.phpt +++ b/ext/uri/tests/055.phpt @@ -6,8 +6,8 @@ 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"; + 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..2a5ec8438e96 100644 --- a/ext/uri/tests/101.phpt +++ b/ext/uri/tests/101.phpt @@ -8,13 +8,13 @@ zend_test try { var_dump(zend_test_uri_parser('invalid uri', "Uri\\WhatWg\\Url")); } catch (\Uri\WhatWg\InvalidUrlException $e) { - echo $e->getMessage(), PHP_EOL; + 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..f2b251b50dcf 100644 --- a/ext/uri/tests/gh19780.phpt +++ b/ext/uri/tests/gh19780.phpt @@ -10,7 +10,7 @@ use Uri\WhatWg\UrlValidationErrorType; try { new InvalidUrlException('message', ['foo']); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + echo $e::class, ': ', $e->getMessage(), "\n"; } try { @@ -18,10 +18,10 @@ try { 1 => new UrlValidationError('context', UrlValidationErrorType::HostMissing, true) ]); } catch (ValueError $e) { - echo $e->getMessage(), "\n"; + 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 From e8a6d4fbfbd48c88653aff1f1337f060d6253859 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Fri, 14 Aug 2026 20:47:28 +0700 Subject: [PATCH 2/2] ext/uri: switched catch to throwable --- ext/uri/tests/004.phpt | 2 +- ext/uri/tests/007.phpt | 4 ++-- ext/uri/tests/015.phpt | 4 ++-- ext/uri/tests/023.phpt | 8 ++++---- ext/uri/tests/026.phpt | 18 ++++++++--------- ext/uri/tests/026_userinfo.phpt | 2 +- ext/uri/tests/027.phpt | 2 +- ext/uri/tests/028.phpt | 4 ++-- ext/uri/tests/029.phpt | 2 +- ext/uri/tests/030.phpt | 4 ++-- ext/uri/tests/031.phpt | 34 ++++++++++++++++----------------- ext/uri/tests/051.phpt | 4 ++-- ext/uri/tests/052.phpt | 2 +- ext/uri/tests/053.phpt | 8 ++++---- ext/uri/tests/054.phpt | 2 +- ext/uri/tests/055.phpt | 2 +- ext/uri/tests/101.phpt | 2 +- ext/uri/tests/gh19780.phpt | 4 ++-- 18 files changed, 54 insertions(+), 54 deletions(-) diff --git a/ext/uri/tests/004.phpt b/ext/uri/tests/004.phpt index 9a47ac9a8d91..c6ad96ce99a7 100644 --- a/ext/uri/tests/004.phpt +++ b/ext/uri/tests/004.phpt @@ -8,7 +8,7 @@ var_dump(Uri\Rfc3986\Uri::parse("")); try { new Uri\WhatWg\Url(""); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/007.phpt b/ext/uri/tests/007.phpt index d17f53e2f2b2..9d2f389e2513 100644 --- a/ext/uri/tests/007.phpt +++ b/ext/uri/tests/007.phpt @@ -5,13 +5,13 @@ Test URI creation errors try { new Uri\Rfc3986\Uri("https://example.com:8080@username:password/path?q=r#fragment"); -} catch (Uri\InvalidUriException $e) { +} 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) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->errors); } diff --git a/ext/uri/tests/015.phpt b/ext/uri/tests/015.phpt index 7f04b4ada0bc..e3a846f5e314 100644 --- a/ext/uri/tests/015.phpt +++ b/ext/uri/tests/015.phpt @@ -9,14 +9,14 @@ uri try { $reflectionClass = new ReflectionClass(Uri\Rfc3986\Uri::class); $reflectionClass->newInstanceWithoutConstructor(); -} catch (ReflectionException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $reflectionClass = new ReflectionClass(Uri\WhatWg\Url::class); $reflectionClass->newInstanceWithoutConstructor(); -} catch (ReflectionException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/023.phpt b/ext/uri/tests/023.phpt index 7ecea0b1414a..8899abc16b6c 100644 --- a/ext/uri/tests/023.phpt +++ b/ext/uri/tests/023.phpt @@ -17,13 +17,13 @@ var_dump($uri3->getScheme()); try { $uri3->withScheme(""); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withScheme("http%73"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -35,13 +35,13 @@ var_dump($url2->getScheme()); try { $url2->withScheme(""); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url2->withScheme("http%73"); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/026.phpt b/ext/uri/tests/026.phpt index 64205aa82d05..179b00d38572 100644 --- a/ext/uri/tests/026.phpt +++ b/ext/uri/tests/026.phpt @@ -29,25 +29,25 @@ var_dump($uri6->getHost()); try { $uri3->withHost("test.com:8080"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withHost("t%3As%2Ft.com"); // t:s/t.com -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri3->withHost("t:s/t.com"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri2->withHost(""); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -59,7 +59,7 @@ var_dump($uri2->getHost()); try { $uri1->withHost(null); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -77,25 +77,25 @@ var_dump($url5->getAsciiHost()); try { $url3->withHost("test.com:8080"); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} 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) { +} 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) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $url2->withHost(null); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/026_userinfo.phpt b/ext/uri/tests/026_userinfo.phpt index 4c7edfd5eb0d..a29abddf9720 100644 --- a/ext/uri/tests/026_userinfo.phpt +++ b/ext/uri/tests/026_userinfo.phpt @@ -25,7 +25,7 @@ var_dump($uri2->getPort()); try { $uri4->withUserInfo("u:s/r"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/027.phpt b/ext/uri/tests/027.phpt index ea5d96f95292..2309cace93d9 100644 --- a/ext/uri/tests/027.phpt +++ b/ext/uri/tests/027.phpt @@ -29,7 +29,7 @@ var_dump($uri2->getPort()); try { $uri1->withPort(1); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/028.phpt b/ext/uri/tests/028.phpt index f3806c1ed2ab..708a50d4f2ec 100644 --- a/ext/uri/tests/028.phpt +++ b/ext/uri/tests/028.phpt @@ -25,13 +25,13 @@ var_dump($uri5->getPath()); try { $uri5->withPath("test"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri5->withPath("/#"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/029.phpt b/ext/uri/tests/029.phpt index 8bb0158090e7..c1ce0e10d94c 100644 --- a/ext/uri/tests/029.phpt +++ b/ext/uri/tests/029.phpt @@ -37,7 +37,7 @@ var_dump($uri5->getQuery()); try { $uri5->withQuery("#"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/030.phpt b/ext/uri/tests/030.phpt index 8912cf096ac4..e3df0f939980 100644 --- a/ext/uri/tests/030.phpt +++ b/ext/uri/tests/030.phpt @@ -17,13 +17,13 @@ var_dump($uri3->getFragment()); try { $uri3->withFragment(" "); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $uri1->withFragment("#fragment2"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/031.phpt b/ext/uri/tests/031.phpt index e7454a7d7f79..d60190457c1e 100644 --- a/ext/uri/tests/031.phpt +++ b/ext/uri/tests/031.phpt @@ -12,49 +12,49 @@ var_dump($uri2); try { unserialize('O:15:"Uri\Rfc3986\Uri":1:{i:0;a:0:{}}'); // less than 2 items -} catch (Exception $e) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -67,55 +67,55 @@ var_dump($url2); try { unserialize('O:14:"Uri\WhatWg\Url":1:{i:0;a:0:{}}'); // less than 2 items -} catch (Exception $e) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} 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) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/051.phpt b/ext/uri/tests/051.phpt index 722254e059ec..cb9c975d2385 100644 --- a/ext/uri/tests/051.phpt +++ b/ext/uri/tests/051.phpt @@ -7,7 +7,7 @@ $uri = new Uri\Rfc3986\Uri("https://example.com"); try { $uri->resolve("á"); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -15,7 +15,7 @@ $url = new Uri\WhatWg\Url("https://example.com"); try { $url->resolve("https://1.2.3.4.5"); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/052.phpt b/ext/uri/tests/052.phpt index fbe1cc90558b..b0867b02bd5a 100644 --- a/ext/uri/tests/052.phpt +++ b/ext/uri/tests/052.phpt @@ -7,7 +7,7 @@ $r = new Uri\WhatWg\UrlValidationError('foo', Uri\WhatWg\UrlValidationErrorType: try { $r->__construct('bar', Uri\WhatWg\UrlValidationErrorType::HostMissing, false); -} catch (Error $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/053.phpt b/ext/uri/tests/053.phpt index c077c68452fc..7f68772e5487 100644 --- a/ext/uri/tests/053.phpt +++ b/ext/uri/tests/053.phpt @@ -12,25 +12,25 @@ $r = new Uri\WhatWg\InvalidUrlException( try { $r->__construct("foo"); -} catch (Error $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("bar", []); -} catch (Error $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("baz", [], 0); -} catch (Error $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } try { $r->__construct("qax", [], 0, null); -} catch (Error $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } diff --git a/ext/uri/tests/054.phpt b/ext/uri/tests/054.phpt index b8670395162f..386f88ae93e5 100644 --- a/ext/uri/tests/054.phpt +++ b/ext/uri/tests/054.phpt @@ -5,7 +5,7 @@ Test UrlValidationErrorType singleton try { new \Uri\WhatWg\Url('http://localhost:99999'); -} catch (Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->errors[0]->type === \Uri\WhatWg\UrlValidationErrorType::PortOutOfRange); } diff --git a/ext/uri/tests/055.phpt b/ext/uri/tests/055.phpt index 1b2349142352..fddb313149df 100644 --- a/ext/uri/tests/055.phpt +++ b/ext/uri/tests/055.phpt @@ -5,7 +5,7 @@ Test InvalidUrlException constructor error handling try { var_dump(new Uri\Rfc3986\Uri('foo', new Uri\Rfc3986\Uri('bar'))); -} catch (Uri\InvalidUriException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> diff --git a/ext/uri/tests/101.phpt b/ext/uri/tests/101.phpt index 2a5ec8438e96..b00eeac8f804 100644 --- a/ext/uri/tests/101.phpt +++ b/ext/uri/tests/101.phpt @@ -7,7 +7,7 @@ zend_test try { var_dump(zend_test_uri_parser('invalid uri', "Uri\\WhatWg\\Url")); -} catch (\Uri\WhatWg\InvalidUrlException $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; var_dump($e->errors); } diff --git a/ext/uri/tests/gh19780.phpt b/ext/uri/tests/gh19780.phpt index f2b251b50dcf..24a3fed9e2a6 100644 --- a/ext/uri/tests/gh19780.phpt +++ b/ext/uri/tests/gh19780.phpt @@ -9,7 +9,7 @@ use Uri\WhatWg\UrlValidationErrorType; try { new InvalidUrlException('message', ['foo']); -} catch (ValueError $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -17,7 +17,7 @@ try { new InvalidUrlException('message', [ 1 => new UrlValidationError('context', UrlValidationErrorType::HostMissing, true) ]); -} catch (ValueError $e) { +} catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; }