diff --git a/ext/uri/php_uri_common.c b/ext/uri/php_uri_common.c index e4850d8059ee..bd498d58f09c 100644 --- a/ext/uri/php_uri_common.c +++ b/ext/uri/php_uri_common.c @@ -40,24 +40,20 @@ static zend_string *get_known_string_by_property_name(php_uri_property_name prop } } -zend_result php_uri_pass_errors_by_ref_and_free(zval *errors_zv, zval *errors) +ZEND_ATTRIBUTE_NONNULL_ARGS(2) zend_result php_uri_pass_errors_by_ref_and_free(zval *errors_zv, HashTable *errors) { - ZEND_ASSERT(Z_TYPE_P(errors) == IS_UNDEF || Z_TYPE_P(errors) == IS_ARRAY); + zval errors_tmp; + ZVAL_ARR(&errors_tmp, errors); - /* There was no error during parsing */ - if (Z_ISUNDEF_P(errors)) { - return SUCCESS; - } - - /* The errors parameter is an array, but the pass-by ref argument stored by - * errors_zv was not passed - the URI implementation either doesn't support - * returning additional error information, or the caller is not interested in it */ + /* The pass-by ref argument stored by errors_zv was not passed - the URI + * implementation either doesn't support returning additional error information, + * or the caller is not interested in it */ if (errors_zv == NULL) { - zval_ptr_dtor(errors); + zval_ptr_dtor(&errors_tmp); return SUCCESS; } - ZEND_TRY_ASSIGN_REF_TMP(errors_zv, errors); + ZEND_TRY_ASSIGN_REF_TMP(errors_zv, &errors_tmp); if (EG(exception)) { return FAILURE; } diff --git a/ext/uri/php_uri_common.h b/ext/uri/php_uri_common.h index a1d9d852f3b7..a125ef17d1c4 100644 --- a/ext/uri/php_uri_common.h +++ b/ext/uri/php_uri_common.h @@ -188,7 +188,7 @@ static inline const php_uri_property_handler *php_uri_parser_property_handler_by } } -zend_result php_uri_pass_errors_by_ref_and_free(zval *errors_zv, zval *errors); +ZEND_ATTRIBUTE_NONNULL_ARGS(2) zend_result php_uri_pass_errors_by_ref_and_free(zval *errors_zv, HashTable *errors); void php_uri_property_read_helper(INTERNAL_FUNCTION_PARAMETERS, php_uri_property_name property_name, php_uri_component_read_mode component_read_mode); void php_uri_property_write_str_helper(INTERNAL_FUNCTION_PARAMETERS, php_uri_property_name property_name); void php_uri_property_write_str_or_null_helper(INTERNAL_FUNCTION_PARAMETERS, php_uri_property_name property_name); diff --git a/ext/uri/tests/whatwg/builder/build_error_soft_errors_reset_without_base.phpt b/ext/uri/tests/whatwg/builder/build_error_soft_errors_reset_without_base.phpt index f43ab31164bf..a9fa607b5a9f 100644 --- a/ext/uri/tests/whatwg/builder/build_error_soft_errors_reset_without_base.phpt +++ b/ext/uri/tests/whatwg/builder/build_error_soft_errors_reset_without_base.phpt @@ -3,6 +3,14 @@ Test Uri\WhatWg\UrlBuilder::build() - error - clears soft errors when an excepti --FILE-- errors; +} + $builder = new Uri\WhatWg\UrlBuilder(); $builder->setScheme("ht\ttps"); $builder->setHost(null); @@ -13,6 +21,10 @@ try { } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; var_dump($e->errors); + var_dump( + array_map(static fn($error) => $error->type, $e->errors) + === array_map(static fn($error) => $error->type, $referenceErrors) + ); } var_dump($softErrors); @@ -24,21 +36,22 @@ array(2) { [0]=> object(Uri\WhatWg\UrlValidationError)#%d (%d) { ["context"]=> - string(4) " tps" + string(0) "" ["type"]=> - enum(Uri\WhatWg\UrlValidationErrorType::InvalidUrlUnit) + enum(Uri\WhatWg\UrlValidationErrorType::HostMissing) ["failure"]=> - bool(false) + bool(true) } [1]=> object(Uri\WhatWg\UrlValidationError)#%d (%d) { ["context"]=> - string(0) "" + string(4) " tps" ["type"]=> - enum(Uri\WhatWg\UrlValidationErrorType::HostMissing) + enum(Uri\WhatWg\UrlValidationErrorType::InvalidUrlUnit) ["failure"]=> - bool(true) + bool(false) } } +bool(true) array(0) { } diff --git a/ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings_with_base.phpt b/ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings_with_base.phpt new file mode 100644 index 000000000000..01ce4c586d21 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_multiple_validation_warnings_with_base.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - multiple validation warnings with base URL +--FILE-- +setHost('127.0.0.1.') + ->setPath('\newPath') + ->build($base, $errors); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($errors); +var_dump($errors == $referenceErrors); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->equals($reference, Uri\UriComparisonMode::IncludeFragment)); + +?> +--EXPECTF-- +string(25) "https://127.0.0.1/newPath" +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(8) "/newPath" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +array(2) { + [0]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(8) "\newPath" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::InvalidReverseSoldius) + ["failure"]=> + bool(false) + } + [1]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(0) "" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::Ipv4EmptyPart) + ["failure"]=> + bool(false) + } +} +bool(true) +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_soft_errors_with_base.phpt b/ext/uri/tests/whatwg/builder/build_success_soft_errors_with_base.phpt index 7f2b37146627..c4baff32ce59 100644 --- a/ext/uri/tests/whatwg/builder/build_success_soft_errors_with_base.phpt +++ b/ext/uri/tests/whatwg/builder/build_success_soft_errors_with_base.phpt @@ -25,7 +25,8 @@ array(2) { [0]=> object(Uri\WhatWg\UrlValidationError)#%d (%d) { ["context"]=> - string(2) " b" + string(2) " +y" ["type"]=> enum(Uri\WhatWg\UrlValidationErrorType::InvalidUrlUnit) ["failure"]=> @@ -34,8 +35,7 @@ array(2) { [1]=> object(Uri\WhatWg\UrlValidationError)#%d (%d) { ["context"]=> - string(2) " -y" + string(2) " b" ["type"]=> enum(Uri\WhatWg\UrlValidationErrorType::InvalidUrlUnit) ["failure"]=> diff --git a/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_with_base.phpt b/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_with_base.phpt new file mode 100644 index 000000000000..27a266b46e86 --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_with_base.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - validation warning order with base URL +--FILE-- +setUsername('newUser') + ->setPassword('newPass') + ->setHost('127.0.0.1.') + ->setPath('\newPath') + ->build($base, $errors); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($errors); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->equals($reference, Uri\UriComparisonMode::IncludeFragment)); + +?> +--EXPECTF-- +string(41) "https://newUser:newPass@127.0.0.1/newPath" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(5) "https" + ["username"]=> + string(7) "newUser" + ["password"]=> + string(7) "newPass" + ["host"]=> + string(9) "127.0.0.1" + ["port"]=> + NULL + ["path"]=> + string(8) "/newPath" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +array(2) { + [0]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(8) "\newPath" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::InvalidReverseSoldius) + ["failure"]=> + bool(false) + } + [1]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(0) "" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::Ipv4EmptyPart) + ["failure"]=> + bool(false) + } +} +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_without_authority_with_base.phpt b/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_without_authority_with_base.phpt new file mode 100644 index 000000000000..785bb6fba40b --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_without_authority_with_base.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - validation warning order without authority and with base URL +--FILE-- +setPath('/foo\bar') + ->setFragment('%') + ->build($base, $errors); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($errors); +var_dump( + array_map(static fn($error) => $error->type, $errors) + === array_map(static fn($error) => $error->type, $referenceErrors) +); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->equals($reference, Uri\UriComparisonMode::IncludeFragment)); + +?> +--EXPECTF-- +string(29) "https://example.com/foo/bar#%" +object(Uri\WhatWg\Url)#%d (%d) { + ["scheme"]=> + string(5) "https" + ["username"]=> + NULL + ["password"]=> + NULL + ["host"]=> + string(11) "example.com" + ["port"]=> + NULL + ["path"]=> + string(8) "/foo/bar" + ["query"]=> + NULL + ["fragment"]=> + string(1) "%" +} +array(2) { + [0]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(1) "%" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::InvalidUrlUnit) + ["failure"]=> + bool(false) + } + [1]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(4) "\bar" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::InvalidReverseSoldius) + ["failure"]=> + bool(false) + } +} +bool(true) +bool(true) +bool(true) diff --git a/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_without_base.phpt b/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_without_base.phpt new file mode 100644 index 000000000000..8615b2a7546c --- /dev/null +++ b/ext/uri/tests/whatwg/builder/build_success_validation_warning_order_without_base.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test Uri\WhatWg\UrlBuilder::build() - success - validation warning order without base URL +--FILE-- +setScheme('https') + ->setHost('127.0.0.1.') + ->setPath('\newPath') + ->build(null, $errors); + +var_dump($url->toAsciiString()); +var_dump($url); +var_dump($errors); +var_dump($errors == $referenceErrors); +var_dump($url->equals(new Uri\WhatWg\Url($url->toAsciiString()))); +var_dump($url->equals($reference, Uri\UriComparisonMode::IncludeFragment)); + +?> +--EXPECTF-- +string(25) "https://127.0.0.1/newPath" +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(8) "/newPath" + ["query"]=> + NULL + ["fragment"]=> + NULL +} +array(2) { + [0]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(8) "\newPath" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::InvalidReverseSoldius) + ["failure"]=> + bool(false) + } + [1]=> + object(Uri\WhatWg\UrlValidationError)#%d (%d) { + ["context"]=> + string(0) "" + ["type"]=> + enum(Uri\WhatWg\UrlValidationErrorType::Ipv4EmptyPart) + ["failure"]=> + bool(false) + } +} +bool(true) +bool(true) +bool(true) diff --git a/ext/uri/uri_parser_whatwg.c b/ext/uri/uri_parser_whatwg.c index 1a258c6c940c..ddbf0ae6752c 100644 --- a/ext/uri/uri_parser_whatwg.c +++ b/ext/uri/uri_parser_whatwg.c @@ -974,44 +974,48 @@ ZEND_ATTRIBUTE_NONNULL static lxb_url_scheme_type_t php_uri_parser_whatwg_get_sp return LXB_URL_SCHEMEL_TYPE__UNDEF; } -ZEND_ATTRIBUTE_NONNULL static const char *php_uri_parser_whatwg_build_errors(zval *errors) +ZEND_ATTRIBUTE_NONNULL static const char *php_uri_parser_whatwg_build_errors(HashTable *errors) { - size_t log_len; - - if (lexbor_parser.log == NULL || (log_len = lexbor_plog_length(lexbor_parser.log)) == 0) { + if (lexbor_parser.log == NULL || lexbor_plog_length(lexbor_parser.log) == 0) { return NULL; } - if (Z_TYPE_P(errors) != IS_ARRAY) { - zval_ptr_dtor(errors); - array_init_size(errors, log_len); + if (zend_hash_num_elements(errors) == 0) { + return fill_errors_inner(errors); } - return fill_errors_inner(Z_ARRVAL_P(errors)); + HashTable *previous_errors = zend_array_dup(errors); + zend_hash_clean(errors); + const char *reason = fill_errors_inner(errors); + ZEND_HASH_FOREACH_VAL(previous_errors, zval *error) { + Z_TRY_ADDREF_P(error); + zend_hash_next_index_insert(errors, error); + } ZEND_HASH_FOREACH_END(); + zend_array_destroy(previous_errors); + + return reason; } -ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_build_errors_into_exception(zval *errors) +ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_build_errors_into_exception(HashTable *errors) { /* Include errors from earlier components in the exception raised by a later component. */ - if (zend_hash_num_elements(Z_ARRVAL_P(errors)) > 0 && EG(exception) + if (zend_hash_num_elements(errors) > 0 && EG(exception) && instanceof_function(EG(exception)->ce, php_uri_ce_whatwg_invalid_url_exception)) { zval rv; zval *exception_errors = zend_read_property(php_uri_ce_whatwg_invalid_url_exception, EG(exception), ZEND_STRL("errors"), true, &rv); ZEND_ASSERT(Z_TYPE_P(exception_errors) == IS_ARRAY); + SEPARATE_ARRAY(exception_errors); zval *error; - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(exception_errors), error) { + ZEND_HASH_FOREACH_VAL(errors, error) { Z_TRY_ADDREF_P(error); - zend_hash_next_index_insert(Z_ARRVAL_P(errors), error); + zend_hash_next_index_insert(Z_ARRVAL_P(exception_errors), error); } ZEND_HASH_FOREACH_END(); - - zval_ptr_dtor(exception_errors); - ZVAL_COPY(exception_errors, errors); } } -ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_build_errors_and_throw(const lxb_status_t status, const char *component, zval *errors) +ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_build_errors_and_throw(const lxb_status_t status, const char *component, HashTable *errors) { if (status != LXB_STATUS_OK) { throw_invalid_url_exception_during_write(NULL, component); @@ -1050,6 +1054,12 @@ ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_fragment_set_null(lxb_u } } +ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_whatwg_build_from_zval( + lxb_url_t *lexbor_base_url, const zval *scheme, const zval *username, const zval *password, + const zval *host, const zval *port, const zval *path, const zval *query, const zval *fragment, + zval *soft_errors_zv +); + ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_whatwg_resolve_reference_from_zval( lxb_url_t *lexbor_base_url, const zval *scheme, const zval *username, const zval *password, const zval *host, const zval *port, const zval *path, const zval *query, const zval *fragment, @@ -1154,7 +1164,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser lxb_url_parser_clean(&lexbor_parser); status = lxb_url_parse_basic(&lexbor_parser, lexbor_url, lexbor_base_url, (const lxb_char_t *) ZSTR_VAL(input), ZSTR_LEN(input), state, LXB_ENCODING_UTF_8); - php_uri_parser_whatwg_build_errors_and_throw(status, "path", &errors); + php_uri_parser_whatwg_build_errors_and_throw(status, "path", Z_ARRVAL(errors)); zend_string_release(input); if (status != LXB_STATUS_OK) { goto failure; @@ -1171,7 +1181,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser (lxb_char_t *) Z_STRVAL_P(query), Z_STRLEN_P(query), LXB_URL_STATE_QUERY_STATE, LXB_ENCODING_AUTO ); - php_uri_parser_whatwg_build_errors_and_throw(status, "query", &errors); + php_uri_parser_whatwg_build_errors_and_throw(status, "query", Z_ARRVAL(errors)); if (status != LXB_STATUS_OK) { goto failure; } @@ -1184,14 +1194,14 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser (lxb_char_t *) Z_STRVAL_P(fragment), Z_STRLEN_P(fragment), LXB_URL_STATE_FRAGMENT_STATE, LXB_ENCODING_AUTO ); - php_uri_parser_whatwg_build_errors_and_throw(status, "fragment", &errors); + php_uri_parser_whatwg_build_errors_and_throw(status, "fragment", Z_ARRVAL(errors)); if (status != LXB_STATUS_OK) { goto failure; } } - if (php_uri_pass_errors_by_ref_and_free(soft_errors_zv, &errors) == FAILURE) { - /* The errors zval was already consumed; goto failure would destroy it again. */ + if (php_uri_pass_errors_by_ref_and_free(soft_errors_zv, Z_ARRVAL(errors)) == FAILURE) { + /* The errors array was already consumed; goto failure would destroy it again. */ lxb_url_destroy(lexbor_url); return NULL; } @@ -1199,14 +1209,14 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser return lexbor_url; failure: - php_uri_parser_whatwg_build_errors_into_exception(&errors); + php_uri_parser_whatwg_build_errors_into_exception(Z_ARRVAL(errors)); zval_ptr_dtor(&errors); lxb_url_destroy(lexbor_url); return NULL; } ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_parser_whatwg_build_path( - lxb_url_t *lexbor_url, const zval *path, const zval *query, const zval *fragment, zval *errors + lxb_url_t *lexbor_url, const zval *path, const zval *query, const zval *fragment, HashTable *errors ) { zend_result result; const char *path_start = Z_STRVAL_P(path); @@ -1288,7 +1298,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_wh array_init(&errors); zend_result result = php_uri_parser_whatwg_scheme_write(lexbor_url, scheme, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } @@ -1297,7 +1307,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_wh * Otherwise, preserve the absent host so the path can be opaque. */ if (Z_TYPE_P(host) == IS_STRING || lxb_url_is_special(lexbor_url)) { result = php_uri_parser_whatwg_host_write(lexbor_url, host, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } @@ -1324,27 +1334,27 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_wh /* Intentionally writing username after host to avoid error when the username is set but the host is missing */ result = php_uri_parser_whatwg_username_write(lexbor_url, username, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } /* Intentionally writing password after host to avoid error when the password is set but the password is missing */ result = php_uri_parser_whatwg_password_write(lexbor_url, password, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } /* Intentionally writing port after host to avoid error when the port is set but the host is missing */ result = php_uri_parser_whatwg_port_write(lexbor_url, port, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } - result = php_uri_parser_whatwg_build_path(lexbor_url, path, query, fragment, &errors); - php_uri_parser_whatwg_build_errors(&errors); + result = php_uri_parser_whatwg_build_path(lexbor_url, path, query, fragment, Z_ARRVAL(errors)); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } @@ -1356,7 +1366,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_wh lexbor_str_init(&lexbor_url->query, lexbor_url->mraw, 1); } else { result = php_uri_parser_whatwg_query_write(lexbor_url, query, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } @@ -1369,14 +1379,14 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_wh lexbor_str_init(&lexbor_url->fragment, lexbor_url->mraw, 1); } else { result = php_uri_parser_whatwg_fragment_write(lexbor_url, fragment, NULL); - php_uri_parser_whatwg_build_errors(&errors); + php_uri_parser_whatwg_build_errors(Z_ARRVAL(errors)); if (result == FAILURE) { goto failure; } } - if (php_uri_pass_errors_by_ref_and_free(soft_errors_zv, &errors) == FAILURE) { - /* The errors zval was already consumed; goto failure would destroy it again. */ + if (php_uri_pass_errors_by_ref_and_free(soft_errors_zv, Z_ARRVAL(errors)) == FAILURE) { + /* The errors array was already consumed; goto failure would destroy it again. */ lxb_url_destroy(lexbor_url); return NULL; } @@ -1384,7 +1394,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser_wh return lexbor_url; failure: ZEND_ASSERT(EG(exception)); - php_uri_parser_whatwg_build_errors_into_exception(&errors); + php_uri_parser_whatwg_build_errors_into_exception(Z_ARRVAL(errors)); zval_ptr_dtor(&errors); lxb_url_destroy(lexbor_url); return NULL;