diff --git a/ext/uri/php_uri.c b/ext/uri/php_uri.c index 595caafa5ac18..d6fbac50c78ad 100644 --- a/ext/uri/php_uri.c +++ b/ext/uri/php_uri.c @@ -1077,7 +1077,7 @@ static PHP_MSHUTDOWN_FUNCTION(uri) PHP_RINIT_FUNCTION(uri) { - if (lexbor_request_init() == FAILURE) { + if (PHP_RINIT(uri_parser_whatwg)(INIT_FUNC_ARGS_PASSTHRU) == FAILURE) { return FAILURE; } @@ -1086,7 +1086,9 @@ PHP_RINIT_FUNCTION(uri) PHP_RSHUTDOWN_FUNCTION(uri) { - lexbor_request_shutdown(); + if (PHP_RSHUTDOWN(uri_parser_whatwg)(INIT_FUNC_ARGS_PASSTHRU) == FAILURE) { + return FAILURE; + } return SUCCESS; } diff --git a/ext/uri/uri_parser_rfc3986.c b/ext/uri/uri_parser_rfc3986.c index 963eb210dfd4a..067df9dc822e4 100644 --- a/ext/uri/uri_parser_rfc3986.c +++ b/ext/uri/uri_parser_rfc3986.c @@ -283,7 +283,7 @@ static uriparser_uris_t *uriparser_create_uris(void) return uriparser_uris; } -void *uriparser_parse_uri_ex(const char *uri_str, size_t uri_str_len, const uriparser_uris_t *uriparser_base_urls, bool silent) +uriparser_uris_t *uriparser_parse_uri_ex(const char *uri_str, size_t uri_str_len, const uriparser_uris_t *uriparser_base_urls, bool silent) { UriUriA uri = {0}; diff --git a/ext/uri/uri_parser_rfc3986.h b/ext/uri/uri_parser_rfc3986.h index 1baf80c2f086b..e15cf803ecc0e 100644 --- a/ext/uri/uri_parser_rfc3986.h +++ b/ext/uri/uri_parser_rfc3986.h @@ -30,6 +30,6 @@ typedef struct uriparser_uris_t { zend_result uriparser_read_userinfo(const uri_internal_t *internal_uri, uri_component_read_mode_t read_mode, zval *retval); -void *uriparser_parse_uri_ex(const char *uri_str, size_t uri_str_len, const uriparser_uris_t *uriparser_base_url, bool silent); +uriparser_uris_t *uriparser_parse_uri_ex(const char *uri_str, size_t uri_str_len, const uriparser_uris_t *uriparser_base_url, bool silent); #endif diff --git a/ext/uri/uri_parser_whatwg.c b/ext/uri/uri_parser_whatwg.c index d21b71c273450..4755650bd3850 100644 --- a/ext/uri/uri_parser_whatwg.c +++ b/ext/uri/uri_parser_whatwg.c @@ -533,7 +533,7 @@ static zend_result lexbor_write_fragment(struct uri_internal_t *internal_uri, zv return SUCCESS; } -zend_result lexbor_request_init(void) +PHP_RINIT_FUNCTION(uri_parser_whatwg) { lexbor_mraw_t *mraw = lexbor_mraw_create(); lxb_status_t status = lexbor_mraw_init(mraw, LEXBOR_MRAW_BYTE_SIZE); @@ -554,12 +554,14 @@ zend_result lexbor_request_init(void) return SUCCESS; } -void lexbor_request_shutdown(void) +PHP_RSHUTDOWN_FUNCTION(uri_parser_whatwg) { lxb_url_parser_memory_destroy(&lexbor_parser); lxb_url_parser_destroy(&lexbor_parser, false); lexbor_urls = 0; + + return SUCCESS; } lxb_url_t *lexbor_parse_uri_ex(const char *uri_str, size_t uri_str_len, const lxb_url_t *lexbor_base_url, zval *errors, bool silent) diff --git a/ext/uri/uri_parser_whatwg.h b/ext/uri/uri_parser_whatwg.h index 2727ff4a3ec25..c52998a725ba3 100644 --- a/ext/uri/uri_parser_whatwg.h +++ b/ext/uri/uri_parser_whatwg.h @@ -24,7 +24,7 @@ extern const uri_parser_t lexbor_uri_parser; lxb_url_t *lexbor_parse_uri_ex(const char *uri_str, size_t uri_str_len, const lxb_url_t *lexbor_base_url, zval *errors, bool silent); -zend_result lexbor_request_init(void); -void lexbor_request_shutdown(void); +PHP_RINIT_FUNCTION(uri_parser_whatwg); +PHP_RSHUTDOWN_FUNCTION(uri_parser_whatwg); #endif