From 8e4b223da30cf74a109274054999784586525836 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Tue, 18 Aug 2026 13:21:03 +0700 Subject: [PATCH] ext/uri: increased test coverage --- .../http_stream_error_invalid_uri.phpt | 14 ++++ .../tests/general/phpinfo_module_info.phpt | 23 ++++++ ...build_error_invalid_internal_fragment.phpt | 19 +++++ .../build_error_invalid_internal_host.phpt | 19 +++++ .../build_error_invalid_internal_query.phpt | 19 +++++ .../build_error_invalid_internal_scheme.phpt | 19 +++++ .../build_success_referenced_component.phpt | 62 ++++++++++++++++ .../rfc3986/builder/host_success_empty.phpt | 35 ++++++++++ ...fo_success_without_password_separator.phpt | 16 +++++ .../host_error_unset_with_port.phpt | 16 +++++ .../parsing/port_error_excessive_digits.phpt | 14 ++++ .../rfc3986/parsing/port_error_overflow.phpt | 12 ---- .../parsing/port_success_maximum_integer.phpt | 19 +++++ ..._success_multiple_validation_warnings.phpt | 51 ++++++++++++++ ...ild_success_scheme_classification_ftp.phpt | 38 ++++++++++ ...ld_success_scheme_classification_http.phpt | 38 ++++++++++ ...ification_non_special_five_characters.phpt | 38 ++++++++++ ...ification_non_special_four_characters.phpt | 38 ++++++++++ ...sification_non_special_two_characters.phpt | 38 ++++++++++ ...uild_success_scheme_classification_ws.phpt | 38 ++++++++++ ...ild_success_scheme_classification_wss.phpt | 38 ++++++++++ .../host_success_ipv6_leading_tab.phpt | 36 ++++++++++ ...structor_error_invalid_errors_element.phpt | 14 ++++ ...ion_error_constructor_reentry_failure.phpt | 18 +++++ ...dation_error_constructor_reentry_type.phpt | 18 +++++ ..._typed_property_reference_invalid_url.phpt | 20 ++++++ ...error_ipv4_in_ipv6_invalid_code_point.phpt | 18 +++++ ..._error_ipv4_in_ipv6_out_of_range_part.phpt | 18 +++++ ...host_error_ipv4_in_ipv6_too_few_parts.phpt | 18 +++++ ...st_error_ipv4_in_ipv6_too_many_pieces.phpt | 18 +++++ .../host_error_ipv4_non_numeric_part.phpt | 18 +++++ .../host_error_ipv4_out_of_range_part.phpt | 18 +++++ .../host_error_ipv6_invalid_compression.phpt | 18 +++++ .../host_error_ipv6_multiple_compression.phpt | 18 +++++ .../host_error_ipv6_too_few_pieces.phpt | 18 +++++ .../host_error_ipv6_too_many_pieces.phpt | 18 +++++ ...lid_windows_drive_letter_host_warning.phpt | 37 ++++++++++ .../host_success_ipv4_empty_part_warning.phpt | 37 ++++++++++ ...success_ipv4_non_decimal_part_warning.phpt | 37 ++++++++++ ...ccess_invalid_reverse_solidus_warning.phpt | 37 ++++++++++ ...invalid_windows_drive_letter_warnings.phpt | 39 +++++++++++ ...ernal_api_error_parse_url_invalid_uri.phpt | 16 +++++ ...s_parse_url_absolute_uri_without_path.phpt | 70 +++++++++++++++++++ ..._success_parse_url_relative_reference.phpt | 70 +++++++++++++++++++ 44 files changed, 1221 insertions(+), 12 deletions(-) create mode 100644 ext/uri/tests/general/http_stream_error_invalid_uri.phpt create mode 100644 ext/uri/tests/general/phpinfo_module_info.phpt create mode 100644 ext/uri/tests/rfc3986/builder/build_error_invalid_internal_fragment.phpt create mode 100644 ext/uri/tests/rfc3986/builder/build_error_invalid_internal_host.phpt create mode 100644 ext/uri/tests/rfc3986/builder/build_error_invalid_internal_query.phpt create mode 100644 ext/uri/tests/rfc3986/builder/build_error_invalid_internal_scheme.phpt create mode 100644 ext/uri/tests/rfc3986/builder/build_success_referenced_component.phpt create mode 100644 ext/uri/tests/rfc3986/builder/host_success_empty.phpt create mode 100644 ext/uri/tests/rfc3986/getters/userinfo_success_without_password_separator.phpt create mode 100644 ext/uri/tests/rfc3986/modification/host_error_unset_with_port.phpt create mode 100644 ext/uri/tests/rfc3986/parsing/port_error_excessive_digits.phpt create mode 100644 ext/uri/tests/rfc3986/parsing/port_success_maximum_integer.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_ftp.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_http.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_five_characters.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_four_characters.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_two_characters.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_ws.phpt create mode 100644 ext/uri/tests/whatwg/builder/build_success_scheme_classification_wss.phpt create mode 100644 ext/uri/tests/whatwg/builder/host_success_ipv6_leading_tab.phpt create mode 100644 ext/uri/tests/whatwg/exceptions/invalid_url_exception_constructor_error_invalid_errors_element.phpt create mode 100644 ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_failure.phpt create mode 100644 ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_type.phpt create mode 100644 ext/uri/tests/whatwg/parsing/errors_error_typed_property_reference_invalid_url.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_invalid_code_point.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_out_of_range_part.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_few_parts.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_many_pieces.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv4_non_numeric_part.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv4_out_of_range_part.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv6_invalid_compression.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv6_multiple_compression.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv6_too_few_pieces.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_error_ipv6_too_many_pieces.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_success_file_invalid_windows_drive_letter_host_warning.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_success_ipv4_empty_part_warning.phpt create mode 100644 ext/uri/tests/whatwg/parsing/host_success_ipv4_non_decimal_part_warning.phpt create mode 100644 ext/uri/tests/whatwg/parsing/path_success_invalid_reverse_solidus_warning.phpt create mode 100644 ext/uri/tests/whatwg/reference_resolution/parse_success_file_invalid_windows_drive_letter_warnings.phpt create mode 100644 ext/uri/tests/zend/internal_api_error_parse_url_invalid_uri.phpt create mode 100644 ext/uri/tests/zend/internal_api_success_parse_url_absolute_uri_without_path.phpt create mode 100644 ext/uri/tests/zend/internal_api_success_parse_url_relative_reference.phpt diff --git a/ext/uri/tests/general/http_stream_error_invalid_uri.phpt b/ext/uri/tests/general/http_stream_error_invalid_uri.phpt new file mode 100644 index 000000000000..da89c40dfe68 --- /dev/null +++ b/ext/uri/tests/general/http_stream_error_invalid_uri.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test HTTP stream URI parsing - error - invalid URI +--INI-- +allow_url_fopen=1 +--FILE-- + +--EXPECT-- +bool(false) diff --git a/ext/uri/tests/general/phpinfo_module_info.phpt b/ext/uri/tests/general/phpinfo_module_info.phpt new file mode 100644 index 000000000000..8fc8127e8ff3 --- /dev/null +++ b/ext/uri/tests/general/phpinfo_module_info.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test phpinfo() - URI module information +--FILE-- + active")); +var_dump( + str_contains($info, "uriparser bundled version") || + ( + str_contains($info, "uriparser compiled version") + && + str_contains($info, "uriparser loaded version") + ) +); + +?> +--EXPECT-- +bool(true) +bool(true) diff --git a/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_fragment.phpt b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_fragment.phpt new file mode 100644 index 000000000000..3c752e64d6bb --- /dev/null +++ b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_fragment.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test Uri\Rfc3986\UriBuilder::build() - error - invalid internal fragment +--EXTENSIONS-- +reflection +--FILE-- +setValue($builder, '<'); + +try { + $builder->build(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: The specified fragment is malformed diff --git a/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_host.phpt b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_host.phpt new file mode 100644 index 000000000000..18f6a7dba317 --- /dev/null +++ b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_host.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test Uri\Rfc3986\UriBuilder::build() - error - invalid internal host +--EXTENSIONS-- +reflection +--FILE-- +setValue($builder, '['); + +try { + $builder->build(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: The specified host is malformed diff --git a/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_query.phpt b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_query.phpt new file mode 100644 index 000000000000..58a49bfd620d --- /dev/null +++ b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_query.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test Uri\Rfc3986\UriBuilder::build() - error - invalid internal query +--EXTENSIONS-- +reflection +--FILE-- +setValue($builder, '<'); + +try { + $builder->build(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: The specified query is malformed diff --git a/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_scheme.phpt b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_scheme.phpt new file mode 100644 index 000000000000..659b2c2d7243 --- /dev/null +++ b/ext/uri/tests/rfc3986/builder/build_error_invalid_internal_scheme.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test Uri\Rfc3986\UriBuilder::build() - error - invalid internal scheme +--EXTENSIONS-- +reflection +--FILE-- +setValue($builder, ':'); + +try { + $builder->build(); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: The specified scheme is malformed diff --git a/ext/uri/tests/rfc3986/builder/build_success_referenced_component.phpt b/ext/uri/tests/rfc3986/builder/build_success_referenced_component.phpt new file mode 100644 index 000000000000..4a546f685886 --- /dev/null +++ b/ext/uri/tests/rfc3986/builder/build_success_referenced_component.phpt @@ -0,0 +1,62 @@ +--TEST-- +Test Uri\Rfc3986\UriBuilder::build() - success - referenced component +--FILE-- +build(); + +var_dump($uri->toRawString()); +var_dump($uri); +var_dump($uri->equals(new Uri\Rfc3986\Uri($uri->toRawString()))); + +?> +--EXPECTF-- +string(30) "https://example.com/path#/path" +object(Uri\Rfc3986\Uri)#%d (%d) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(5) "/path" + ["query"]=> + NULL + ["fragment"]=> + string(5) "/path" +} +bool(true) diff --git a/ext/uri/tests/rfc3986/builder/host_success_empty.phpt b/ext/uri/tests/rfc3986/builder/host_success_empty.phpt new file mode 100644 index 000000000000..f2e597f77994 --- /dev/null +++ b/ext/uri/tests/rfc3986/builder/host_success_empty.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test Uri\Rfc3986\UriBuilder::setHost() - success - empty string +--FILE-- +setHost(''); +$uri = $builder->build(); + +var_dump($uri->toRawString()); +var_dump($uri); +var_dump($uri->equals(new Uri\Rfc3986\Uri($uri->toRawString()))); + +?> +--EXPECTF-- +string(2) "//" +object(Uri\Rfc3986\Uri)#%d (%d) { + ["scheme"]=> + NULL + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(0) "" + ["port"]=> + NULL + ["path"]=> + string(0) "" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) diff --git a/ext/uri/tests/rfc3986/getters/userinfo_success_without_password_separator.phpt b/ext/uri/tests/rfc3986/getters/userinfo_success_without_password_separator.phpt new file mode 100644 index 000000000000..817859957d46 --- /dev/null +++ b/ext/uri/tests/rfc3986/getters/userinfo_success_without_password_separator.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test Uri\Rfc3986\Uri component retrieval - userinfo - without password separator +--FILE-- +getUserInfo()); +var_dump($uri->getUsername()); +var_dump($uri->getPassword()); + +?> +--EXPECT-- +string(4) "user" +string(4) "user" +string(0) "" diff --git a/ext/uri/tests/rfc3986/modification/host_error_unset_with_port.phpt b/ext/uri/tests/rfc3986/modification/host_error_unset_with_port.phpt new file mode 100644 index 000000000000..bb4513fa23b4 --- /dev/null +++ b/ext/uri/tests/rfc3986/modification/host_error_unset_with_port.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test Uri\Rfc3986\Uri::withHost() - error - unsetting with port +--FILE-- +withHost(null); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: Cannot remove the host from a URI that has a port diff --git a/ext/uri/tests/rfc3986/parsing/port_error_excessive_digits.phpt b/ext/uri/tests/rfc3986/parsing/port_error_excessive_digits.phpt new file mode 100644 index 000000000000..135f787fbac9 --- /dev/null +++ b/ext/uri/tests/rfc3986/parsing/port_error_excessive_digits.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test Uri\Rfc3986\Uri parsing - port - excessive number of digits +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: The port is out of range diff --git a/ext/uri/tests/rfc3986/parsing/port_error_overflow.phpt b/ext/uri/tests/rfc3986/parsing/port_error_overflow.phpt index b4d412bc7c25..d0595edf98d2 100644 --- a/ext/uri/tests/rfc3986/parsing/port_error_overflow.phpt +++ b/ext/uri/tests/rfc3986/parsing/port_error_overflow.phpt @@ -3,16 +3,6 @@ Test Uri\Rfc3986\Uri parsing - port - integer overflow --FILE-- getPort(), "\n"; - echo "2147483647", "\n"; -} else { - $uri = new \Uri\Rfc3986\Uri('https://example.com:2147483647'); - echo "9223372036854775807", "\n"; - echo $uri->getPort(), "\n"; -} - try { if (PHP_INT_SIZE == 8) { new \Uri\Rfc3986\Uri('https://example.com:9223372036854775808'); @@ -25,6 +15,4 @@ try { ?> --EXPECT-- -9223372036854775807 -2147483647 Uri\InvalidUriException: The port is out of range diff --git a/ext/uri/tests/rfc3986/parsing/port_success_maximum_integer.phpt b/ext/uri/tests/rfc3986/parsing/port_success_maximum_integer.phpt new file mode 100644 index 000000000000..bab1da702451 --- /dev/null +++ b/ext/uri/tests/rfc3986/parsing/port_success_maximum_integer.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test Uri\Rfc3986\Uri parsing - port - maximum integer +--FILE-- +getPort(), "\n"; + echo "2147483647", "\n"; +} else { + $uri = new \Uri\Rfc3986\Uri('https://example.com:2147483647'); + echo "9223372036854775807", "\n"; + echo $uri->getPort(), "\n"; +} + +?> +--EXPECT-- +9223372036854775807 +2147483647 diff --git a/ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings.phpt b/ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings.phpt new file mode 100644 index 000000000000..64ae7abbe016 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - multiple validation warnings +--EXTENSIONS-- +reflection +--FILE-- + "https", + "host" => "127.0.0.1.", + "path" => "\\foo", +] as $property => $value) { + new ReflectionProperty($builder, $property)->setValue($builder, $value); +} + +$url = $builder->build(errors: $errors); + +var_dump($url->toAsciiString()); +var_dump($url); +foreach ($errors as $error) { + echo $error->type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); + +?> +--EXPECTF-- +string(21) "https://127.0.0.1/foo" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(9) "127.0.0.1" + ["port"]=> + NULL + ["path"]=> + string(4) "/foo" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +Ipv4EmptyPart: : bool(false) +InvalidReverseSoldius: \foo: bool(false) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_ftp.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_ftp.phpt new file mode 100644 index 000000000000..d35c442de0d5 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_ftp.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - ftp scheme classification +--FILE-- +setScheme("ftp") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(18) "ftp://example.com/" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(3) "ftp" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_http.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_http.phpt new file mode 100644 index 000000000000..728ff3076ce2 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_http.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - http scheme classification +--FILE-- +setScheme("http") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(19) "http://example.com/" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "http" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_five_characters.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_five_characters.phpt new file mode 100644 index 000000000000..defe256f331d --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_five_characters.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - five-character non-special scheme classification +--FILE-- +setScheme("about") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(19) "about://example.com" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(5) "about" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(0) "" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(false) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_four_characters.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_four_characters.phpt new file mode 100644 index 000000000000..f11e89c773f1 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_four_characters.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - four-character non-special scheme classification +--FILE-- +setScheme("news") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(18) "news://example.com" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "news" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(0) "" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(false) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_two_characters.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_two_characters.phpt new file mode 100644 index 000000000000..5796ce9be232 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_non_special_two_characters.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - two-character non-special scheme classification +--FILE-- +setScheme("id") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(16) "id://example.com" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(2) "id" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(0) "" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(false) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_ws.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_ws.phpt new file mode 100644 index 000000000000..ca79b409faa7 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_ws.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - ws scheme classification +--FILE-- +setScheme("ws") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(17) "ws://example.com/" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(2) "ws" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_scheme_classification_wss.phpt b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_wss.phpt new file mode 100644 index 000000000000..3b910f711b40 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_scheme_classification_wss.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - wss scheme classification +--FILE-- +setScheme("wss") + ->setHost("example.com") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->isSpecialScheme()); + +?> +--EXPECTF-- +string(18) "wss://example.com/" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(3) "wss" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/host_success_ipv6_leading_tab.phpt b/ext/uri/tests/whatwg/builder/host_success_ipv6_leading_tab.phpt new file mode 100644 index 000000000000..343ac58f0230 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/host_success_ipv6_leading_tab.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::setHost() - success - IPv6 address with a leading tab +--FILE-- +setScheme("https") + ->setHost("\t[::1]") + ->build(); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); + +?> +--EXPECTF-- +string(14) "https://[::1]/" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(5) "[::1]" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +bool(true) diff --git a/ext/uri/tests/whatwg/exceptions/invalid_url_exception_constructor_error_invalid_errors_element.phpt b/ext/uri/tests/whatwg/exceptions/invalid_url_exception_constructor_error_invalid_errors_element.phpt new file mode 100644 index 000000000000..b3e6e0f5a070 --- /dev/null +++ b/ext/uri/tests/whatwg/exceptions/invalid_url_exception_constructor_error_invalid_errors_element.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test Uri\WhatWg\InvalidUrlException::__construct() - error - invalid errors element +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +ValueError: Uri\WhatWg\InvalidUrlException::__construct(): Argument #2 ($errors) must be a list of Uri\WhatWg\UrlValidationError diff --git a/ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_failure.phpt b/ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_failure.phpt new file mode 100644 index 000000000000..fe791b33dc97 --- /dev/null +++ b/ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_failure.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\UrlValidationError::__construct() - error - reentry with initialized failure +--FILE-- +__construct('foo', Uri\WhatWg\UrlValidationErrorType::HostMissing, false); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Error: Cannot modify readonly property Uri\WhatWg\UrlValidationError::$failure diff --git a/ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_type.phpt b/ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_type.phpt new file mode 100644 index 000000000000..e34c57bbe8bb --- /dev/null +++ b/ext/uri/tests/whatwg/exceptions/url_validation_error_constructor_reentry_type.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\UrlValidationError::__construct() - error - reentry with initialized type +--FILE-- +__construct('foo', Uri\WhatWg\UrlValidationErrorType::HostMissing, false); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Error: Cannot modify readonly property Uri\WhatWg\UrlValidationError::$type diff --git a/ext/uri/tests/whatwg/parsing/errors_error_typed_property_reference_invalid_url.phpt b/ext/uri/tests/whatwg/parsing/errors_error_typed_property_reference_invalid_url.phpt new file mode 100644 index 000000000000..5237914a0db9 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/errors_error_typed_property_reference_invalid_url.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - errors - assignment to a typed property reference for an invalid URL +--FILE-- +x); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +TypeError: Cannot assign array to reference held by property Foo::$x of type string diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_invalid_code_point.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_invalid_code_point.phpt new file mode 100644 index 000000000000..318ed6e4bc6d --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_invalid_code_point.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4-in-IPv6 invalid code point +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv4InIpv6InvalidCodePoint: a]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_out_of_range_part.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_out_of_range_part.phpt new file mode 100644 index 000000000000..7f4a49fc2232 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_out_of_range_part.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4-in-IPv6 out-of-range part +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv4InIpv6OutOfRangePart: 6.2.3.4]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_few_parts.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_few_parts.phpt new file mode 100644 index 000000000000..a57a99de30c9 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_few_parts.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4-in-IPv6 too few parts +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv4InIpv6TooFewParts: ]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_many_pieces.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_many_pieces.phpt new file mode 100644 index 000000000000..c9fb21981108 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv4_in_ipv6_too_many_pieces.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4-in-IPv6 too many pieces +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv4InIpv6TooManyPieces: 1.2.3.4]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv4_non_numeric_part.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv4_non_numeric_part.phpt new file mode 100644 index 000000000000..2077c47ef82e --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv4_non_numeric_part.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4 non-numeric part +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv4NonNumericPart: a.2.3: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv4_out_of_range_part.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv4_out_of_range_part.phpt new file mode 100644 index 000000000000..0258ed7fa327 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv4_out_of_range_part.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4 out-of-range part +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv4OutOfRangePart: 256.0.0.1: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv6_invalid_compression.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv6_invalid_compression.phpt new file mode 100644 index 000000000000..7379ec99fc94 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv6_invalid_compression.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv6 invalid compression +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv6InvalidCompression: 1]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv6_multiple_compression.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv6_multiple_compression.phpt new file mode 100644 index 000000000000..deca42e86ce1 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv6_multiple_compression.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv6 multiple compression +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv6MultipleCompression: :1]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv6_too_few_pieces.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv6_too_few_pieces.phpt new file mode 100644 index 000000000000..89b410969dc6 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv6_too_few_pieces.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv6 too few pieces +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv6TooFewPieces: ]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_error_ipv6_too_many_pieces.phpt b/ext/uri/tests/whatwg/parsing/host_error_ipv6_too_many_pieces.phpt new file mode 100644 index 000000000000..521e3f7bc20d --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_error_ipv6_too_many_pieces.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv6 too many pieces +--FILE-- +type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECT-- +NULL +Ipv6TooManyPieces: 9]/: bool(true) diff --git a/ext/uri/tests/whatwg/parsing/host_success_file_invalid_windows_drive_letter_host_warning.phpt b/ext/uri/tests/whatwg/parsing/host_success_file_invalid_windows_drive_letter_host_warning.phpt new file mode 100644 index 000000000000..613a7fd835e8 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_success_file_invalid_windows_drive_letter_host_warning.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - file invalid Windows drive letter host warning +--FILE-- +toAsciiString()); +foreach ($errors as $error) { + echo $error->type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECTF-- +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "file" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(0) "" + ["port"]=> + NULL + ["path"]=> + string(7) "/c:/foo" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +string(14) "file:///c:/foo" +FileInvalidWindowsDriveLetterHost: c:/foo: bool(false) diff --git a/ext/uri/tests/whatwg/parsing/host_success_ipv4_empty_part_warning.phpt b/ext/uri/tests/whatwg/parsing/host_success_ipv4_empty_part_warning.phpt new file mode 100644 index 000000000000..5d456aae1778 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_success_ipv4_empty_part_warning.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4 empty part warning +--FILE-- +toAsciiString()); +foreach ($errors as $error) { + echo $error->type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECTF-- +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "http" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(7) "1.2.0.3" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +string(15) "http://1.2.0.3/" +Ipv4EmptyPart: : bool(false) diff --git a/ext/uri/tests/whatwg/parsing/host_success_ipv4_non_decimal_part_warning.phpt b/ext/uri/tests/whatwg/parsing/host_success_ipv4_non_decimal_part_warning.phpt new file mode 100644 index 000000000000..066affc857de --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/host_success_ipv4_non_decimal_part_warning.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - host - IPv4 non-decimal part warning +--FILE-- +toAsciiString()); +foreach ($errors as $error) { + echo $error->type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECTF-- +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "http" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(7) "1.2.3.4" + ["port"]=> + NULL + ["path"]=> + string(1) "/" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +string(15) "http://1.2.3.4/" +Ipv4NonDecimalPart: /: bool(false) diff --git a/ext/uri/tests/whatwg/parsing/path_success_invalid_reverse_solidus_warning.phpt b/ext/uri/tests/whatwg/parsing/path_success_invalid_reverse_solidus_warning.phpt new file mode 100644 index 000000000000..b1d98e9bb979 --- /dev/null +++ b/ext/uri/tests/whatwg/parsing/path_success_invalid_reverse_solidus_warning.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test Uri\WhatWg\Url parsing - path - invalid reverse solidus warning +--FILE-- +toAsciiString()); +foreach ($errors as $error) { + echo $error->type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECTF-- +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "http" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(4) "/foo" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +string(22) "http://example.com/foo" +InvalidReverseSoldius: \foo: bool(false) diff --git a/ext/uri/tests/whatwg/reference_resolution/parse_success_file_invalid_windows_drive_letter_warnings.phpt b/ext/uri/tests/whatwg/reference_resolution/parse_success_file_invalid_windows_drive_letter_warnings.phpt new file mode 100644 index 000000000000..4dc9cc9d6cb5 --- /dev/null +++ b/ext/uri/tests/whatwg/reference_resolution/parse_success_file_invalid_windows_drive_letter_warnings.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test Uri\WhatWg\Url::parse() - success - file URL with invalid Windows drive letter warnings +--FILE-- +toAsciiString()); +foreach ($errors as $error) { + echo $error->type->name, ': ', $error->context, ': '; + var_dump($error->failure); +} + +?> +--EXPECTF-- +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(4) "file" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(0) "" + ["port"]=> + NULL + ["path"]=> + string(7) "/c:/foo" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +string(14) "file:///c:/foo" +InvalidUrlUnit: |/foo: bool(false) +FileInvalidWindowsDriveLetter: c|/foo: bool(false) diff --git a/ext/uri/tests/zend/internal_api_error_parse_url_invalid_uri.phpt b/ext/uri/tests/zend/internal_api_error_parse_url_invalid_uri.phpt new file mode 100644 index 000000000000..7c29c74b6d81 --- /dev/null +++ b/ext/uri/tests/zend/internal_api_error_parse_url_invalid_uri.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test zend_test_uri_parser() - error - invalid parse_url-based URI +--EXTENSIONS-- +zend_test +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +Uri\InvalidUriException: The specified URI is malformed diff --git a/ext/uri/tests/zend/internal_api_success_parse_url_absolute_uri_without_path.phpt b/ext/uri/tests/zend/internal_api_success_parse_url_absolute_uri_without_path.phpt new file mode 100644 index 000000000000..8da9ffca6dd4 --- /dev/null +++ b/ext/uri/tests/zend/internal_api_success_parse_url_absolute_uri_without_path.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test zend_test_uri_parser() - success - parse_url-based absolute URI without path +--EXTENSIONS-- +zend_test +--FILE-- + +--EXPECT-- +array(3) { + ["normalized"]=> + array(8) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + NULL + ["query"]=> + NULL + ["fragment"]=> + NULL + } + ["raw"]=> + array(8) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + NULL + ["query"]=> + NULL + ["fragment"]=> + NULL + } + ["struct"]=> + array(8) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + int(0) + ["path"]=> + NULL + ["query"]=> + NULL + ["fragment"]=> + NULL + } +} diff --git a/ext/uri/tests/zend/internal_api_success_parse_url_relative_reference.phpt b/ext/uri/tests/zend/internal_api_success_parse_url_relative_reference.phpt new file mode 100644 index 000000000000..f15d53a53092 --- /dev/null +++ b/ext/uri/tests/zend/internal_api_success_parse_url_relative_reference.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test zend_test_uri_parser() - success - parse_url-based relative reference +--EXTENSIONS-- +zend_test +--FILE-- + +--EXPECT-- +array(3) { + ["normalized"]=> + array(8) { + ["scheme"]=> + NULL + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + NULL + ["port"]=> + NULL + ["path"]=> + string(4) "/foo" + ["query"]=> + string(3) "bar" + ["fragment"]=> + string(3) "baz" + } + ["raw"]=> + array(8) { + ["scheme"]=> + NULL + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + NULL + ["port"]=> + NULL + ["path"]=> + string(4) "/foo" + ["query"]=> + string(3) "bar" + ["fragment"]=> + string(3) "baz" + } + ["struct"]=> + array(8) { + ["scheme"]=> + NULL + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + NULL + ["port"]=> + int(0) + ["path"]=> + string(4) "/foo" + ["query"]=> + string(3) "bar" + ["fragment"]=> + string(3) "baz" + } +}