Skip to content

Commit 79a5804

Browse files
authored
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 #20173 Related to #19868
1 parent 94f2bb0 commit 79a5804

File tree

8 files changed

+9
-7
lines changed

8 files changed

+9
-7
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ PHP NEWS
5454
during malformed URL processing). (lexborisov)
5555
. Fixed bug GH-19868 (Unable to use uri_parser_rfc3986.h from external
5656
extensions). (timwolla)
57+
. Make php_uri_parser structs available to extensions directly. (timwolla)
5758

5859
09 Oct 2025, PHP 8.5.0RC2
5960

UPGRADING.INTERNALS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
159159
were removed. Use the corresponding headers in Zend/ instead.
160160

161161
- URI:
162-
. Internal API for URI handling was added via the php_uri_*() functions.
162+
. New extension with an internal API for URI handling is available via the
163+
php_uri_* symbols exposed in the ext/uri/ headers.
163164

164165
========================
165166
4. OpCode changes

ext/uri/uri_parser_php_parse_url.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void uri_parser_php_parse_url_destroy(void *uri)
165165
php_url_free(parse_url_uri);
166166
}
167167

168-
const php_uri_parser php_uri_parser_php_parse_url = {
168+
PHPAPI const php_uri_parser php_uri_parser_php_parse_url = {
169169
.name = PHP_URI_PARSER_PHP_PARSE_URL,
170170
.parse = uri_parser_php_parse_url_parse,
171171
.clone = NULL,

ext/uri/uri_parser_php_parse_url.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020

2121
#include "php_uri_common.h"
2222

23-
extern const php_uri_parser php_uri_parser_php_parse_url;
23+
PHPAPI extern const php_uri_parser php_uri_parser_php_parse_url;
2424

2525
#endif

ext/uri/uri_parser_rfc3986.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ static void php_uri_parser_rfc3986_destroy(void *uri)
615615
efree(uriparser_uris);
616616
}
617617

618-
const php_uri_parser php_uri_parser_rfc3986 = {
618+
PHPAPI const php_uri_parser php_uri_parser_rfc3986 = {
619619
.name = PHP_URI_PARSER_RFC3986,
620620
.parse = php_uri_parser_rfc3986_parse,
621621
.clone = php_uri_parser_rfc3986_clone,

ext/uri/uri_parser_rfc3986.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "php_uri_common.h"
2121

22-
extern const php_uri_parser php_uri_parser_rfc3986;
22+
PHPAPI extern const php_uri_parser php_uri_parser_rfc3986;
2323

2424
typedef struct php_uri_parser_rfc3986_uris php_uri_parser_rfc3986_uris;
2525

ext/uri/uri_parser_whatwg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ static void php_uri_parser_whatwg_destroy(void *uri)
621621
lxb_url_destroy(lexbor_uri);
622622
}
623623

624-
const php_uri_parser php_uri_parser_whatwg = {
624+
PHPAPI const php_uri_parser php_uri_parser_whatwg = {
625625
.name = PHP_URI_PARSER_WHATWG,
626626
.parse = php_uri_parser_whatwg_parse,
627627
.clone = php_uri_parser_whatwg_clone,

ext/uri/uri_parser_whatwg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "php_uri_common.h"
2121
#include "lexbor/url/url.h"
2222

23-
extern const php_uri_parser php_uri_parser_whatwg;
23+
PHPAPI extern const php_uri_parser php_uri_parser_whatwg;
2424

2525
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);
2626

0 commit comments

Comments
 (0)