[php-src] PHP-8.6: ext/uri: Address UrlBuilder todo comments

From: Date: Wed, 07 Oct 2026 10:56:24 +0000
Subject: [php-src] PHP-8.6: ext/uri: Address UrlBuilder todo comments
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142065@lists.php.net to get a copy of this message
Author: Máté Kocsis (kocsismate) Date: 2026-10-07T12:55:35+02:00 Commit: https://github.com/php/php-src/commit/7d1d66246e3ecbdd6d8bf7ae8b99791853b316cb Raw diff: https://github.com/php/php-src/commit/7d1d66246e3ecbdd6d8bf7ae8b99791853b316cb.diff ext/uri: Address UrlBuilder todo comments After https://github.com/lexbor/lexbor/pull/415 was merged to Lexbor and the change was applied to ext/lexbor via https://github.com/php/php-src/pull/23660, the temporary functions can be replaced with their counterpart in Lexbor. Changed paths: M ext/uri/uri_parser_whatwg.c Diff: diff --git a/ext/uri/uri_parser_whatwg.c b/ext/uri/uri_parser_whatwg.c index 2c123cd238d2..4f4f8fcc93bc 100644 --- a/ext/uri/uri_parser_whatwg.c +++ b/ext/uri/uri_parser_whatwg.c @@ -1020,36 +1020,6 @@ ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_build_errors_and_throw( } } -/* TODO: Replace with lxb_url_path_set_null() once https://github.com/lexbor/lexbor/pull/415 is available. */ -ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_path_set_null(lxb_url_t *url) -{ - if (url->path.str.data == NULL) { - return; - } - - (void) lexbor_str_destroy(&url->path.str, url->mraw, false); - - url->path.str.length = 0; - url->path.length = 0; - url->path.opaque = false; -} - -/* TODO: Replace with lxb_url_query_set_null() once https://github.com/lexbor/lexbor/pull/415 is available. */ -ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_query_set_null(lxb_url_t *url) -{ - if (url->query.data != NULL) { - (void) lexbor_str_destroy(&url->query, url->mraw, false); - } -} - -/* TODO: Replace with lxb_url_fragment_set_null() once https://github.com/lexbor/lexbor/pull/415 is available. */ -ZEND_ATTRIBUTE_NONNULL static void php_uri_parser_whatwg_fragment_set_null(lxb_url_t *url) -{ - if (url->fragment.data != NULL) { - (void) lexbor_str_destroy(&url->fragment, url->mraw, false); - } -} - 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, @@ -1109,7 +1079,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser } /* Discard the base fragment; the reference fragment is applied below. */ - php_uri_parser_whatwg_fragment_set_null(lexbor_url); + lxb_url_fragment_set_null(lexbor_url); if (Z_STRLEN_P(path) > 0) { /* Resolve relative paths against the base directory. Absolute paths use @@ -1154,7 +1124,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser } zend_string *input = smart_str_extract(&reference); - php_uri_parser_whatwg_path_set_null(lexbor_url); + lxb_url_path_set_null(lexbor_url); 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); @@ -1164,12 +1134,12 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser goto failure; } if (first < end) { - php_uri_parser_whatwg_query_set_null(lexbor_url); + lxb_url_query_set_null(lexbor_url); } } if (Z_TYPE_P(query) == IS_STRING) { - php_uri_parser_whatwg_query_set_null(lexbor_url); + lxb_url_query_set_null(lexbor_url); lxb_url_parser_clean(&lexbor_parser); status = lxb_url_parse_basic(&lexbor_parser, lexbor_url, lexbor_base_url, (lxb_char_t *) Z_STRVAL_P(query), Z_STRLEN_P(query), @@ -1182,7 +1152,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2, 3, 4, 5, 6, 7, 8, 9) lxb_url_t *php_uri_parser } if (Z_TYPE_P(fragment) == IS_STRING) { - php_uri_parser_whatwg_fragment_set_null(lexbor_url); + lxb_url_fragment_set_null(lexbor_url); lxb_url_parser_clean(&lexbor_parser); status = lxb_url_parse_basic(&lexbor_parser, lexbor_url, lexbor_base_url, (lxb_char_t *) Z_STRVAL_P(fragment), Z_STRLEN_P(fragment),

« previous php.cvs (#142065) next »