1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

uri: Make php_uri_parser structs PHPAPI (#20243)

This allows extensions that already know which parser to use and don't need the
generic lookup facility to directly refer to the desired parser without needing
to go through `php_uri_get_parser()` (which also requires allocating a
`zend_string*`).

Following php/php-src#20173
Related to php/php-src#19868
This commit is contained in:
Tim Düsterhus
2025-10-21 16:09:16 +02:00
committed by GitHub
parent 94f2bb0dd5
commit 79a5804b6b
8 changed files with 9 additions and 7 deletions

1
NEWS
View File

@@ -54,6 +54,7 @@ PHP NEWS
during malformed URL processing). (lexborisov)
. Fixed bug GH-19868 (Unable to use uri_parser_rfc3986.h from external
extensions). (timwolla)
. Make php_uri_parser structs available to extensions directly. (timwolla)
09 Oct 2025, PHP 8.5.0RC2

View File

@@ -159,7 +159,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
were removed. Use the corresponding headers in Zend/ instead.
- URI:
. Internal API for URI handling was added via the php_uri_*() functions.
. New extension with an internal API for URI handling is available via the
php_uri_* symbols exposed in the ext/uri/ headers.
========================
4. OpCode changes

View File

@@ -165,7 +165,7 @@ static void uri_parser_php_parse_url_destroy(void *uri)
php_url_free(parse_url_uri);
}
const php_uri_parser php_uri_parser_php_parse_url = {
PHPAPI const php_uri_parser php_uri_parser_php_parse_url = {
.name = PHP_URI_PARSER_PHP_PARSE_URL,
.parse = uri_parser_php_parse_url_parse,
.clone = NULL,

View File

@@ -20,6 +20,6 @@
#include "php_uri_common.h"
extern const php_uri_parser php_uri_parser_php_parse_url;
PHPAPI extern const php_uri_parser php_uri_parser_php_parse_url;
#endif

View File

@@ -615,7 +615,7 @@ static void php_uri_parser_rfc3986_destroy(void *uri)
efree(uriparser_uris);
}
const php_uri_parser php_uri_parser_rfc3986 = {
PHPAPI const php_uri_parser php_uri_parser_rfc3986 = {
.name = PHP_URI_PARSER_RFC3986,
.parse = php_uri_parser_rfc3986_parse,
.clone = php_uri_parser_rfc3986_clone,

View File

@@ -19,7 +19,7 @@
#include "php_uri_common.h"
extern const php_uri_parser php_uri_parser_rfc3986;
PHPAPI extern const php_uri_parser php_uri_parser_rfc3986;
typedef struct php_uri_parser_rfc3986_uris php_uri_parser_rfc3986_uris;

View File

@@ -621,7 +621,7 @@ static void php_uri_parser_whatwg_destroy(void *uri)
lxb_url_destroy(lexbor_uri);
}
const php_uri_parser php_uri_parser_whatwg = {
PHPAPI const php_uri_parser php_uri_parser_whatwg = {
.name = PHP_URI_PARSER_WHATWG,
.parse = php_uri_parser_whatwg_parse,
.clone = php_uri_parser_whatwg_clone,

View File

@@ -20,7 +20,7 @@
#include "php_uri_common.h"
#include "lexbor/url/url.h"
extern const php_uri_parser php_uri_parser_whatwg;
PHPAPI extern const php_uri_parser php_uri_parser_whatwg;
lxb_url_t *php_uri_parser_whatwg_parse_ex(const char *uri_str, size_t uri_str_len, const lxb_url_t *lexbor_base_url, zval *errors, bool silent);