mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
uri: Make uri_parser_rfc3986.h usable for external extensions (#20173)
This header could not previously be used due to the `uriparser/Uri.h` include, which is required for the struct definition. Since this struct is considered an implementation detail, we can just make it opaque, preserving type safety, but without allowing external users to touch its contents. Fixes php/php-src#19868.
This commit is contained in:
2
NEWS
2
NEWS
@@ -48,6 +48,8 @@ PHP NEWS
|
||||
- URI:
|
||||
. Fixed bug GH-20088 (Heap-use-after-free in PHP URI WHATWG parser
|
||||
during malformed URL processing). (lexborisov)
|
||||
. Fixed bug GH-19868 (Unable to use uri_parser_rfc3986.h from external
|
||||
extensions). (timwolla)
|
||||
|
||||
09 Oct 2025, PHP 8.5.0RC2
|
||||
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
#include "Zend/zend_smart_str.h"
|
||||
#include "Zend/zend_exceptions.h"
|
||||
|
||||
#include <uriparser/Uri.h>
|
||||
|
||||
struct php_uri_parser_rfc3986_uris {
|
||||
UriUriA uri;
|
||||
UriUriA normalized_uri;
|
||||
bool normalized_uri_initialized;
|
||||
};
|
||||
|
||||
static void *php_uri_parser_rfc3986_memory_manager_malloc(UriMemoryManager *memory_manager, size_t size)
|
||||
{
|
||||
return emalloc(size);
|
||||
|
||||
@@ -17,16 +17,11 @@
|
||||
#ifndef PHP_URI_PARSER_RFC3986_H
|
||||
#define PHP_URI_PARSER_RFC3986_H
|
||||
|
||||
#include <uriparser/Uri.h>
|
||||
#include "php_uri_common.h"
|
||||
|
||||
extern const php_uri_parser php_uri_parser_rfc3986;
|
||||
|
||||
typedef struct php_uri_parser_rfc3986_uris {
|
||||
UriUriA uri;
|
||||
UriUriA normalized_uri;
|
||||
bool normalized_uri_initialized;
|
||||
} php_uri_parser_rfc3986_uris;
|
||||
typedef struct php_uri_parser_rfc3986_uris php_uri_parser_rfc3986_uris;
|
||||
|
||||
zend_result php_uri_parser_rfc3986_userinfo_read(void *uri, php_uri_component_read_mode read_mode, zval *retval);
|
||||
zend_result php_uri_parser_rfc3986_userinfo_write(void *uri, zval *value, zval *errors);
|
||||
|
||||
Reference in New Issue
Block a user