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

uri: Remove useless uri_property_handlers_t struct (#19622)

* uri: Do not copy the `property_handlers` struct in `uri_get_debug_properties()`

* uri: Remove now-useless `uri_property_handlers_t` struct

This struct was just used for “namespacing” within the `uri_parser_t` struct.
It is no longer referenced anywhere.
This commit is contained in:
Tim Düsterhus
2025-08-30 22:06:29 +02:00
committed by GitHub
parent 22252b03fe
commit 243aedd3aa
2 changed files with 19 additions and 21 deletions

View File

@@ -69,38 +69,38 @@ static HashTable *uri_get_debug_properties(zend_object *object)
return result;
}
const uri_property_handlers_t property_handlers = internal_uri->parser->property_handlers;
const uri_parser_t *parser = internal_uri->parser;
zval tmp;
if (property_handlers.scheme.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.scheme.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_SCHEME), &tmp);
}
if (property_handlers.username.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.username.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_USERNAME), &tmp);
}
if (property_handlers.password.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.password.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_PASSWORD), &tmp);
}
if (property_handlers.host.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.host.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_HOST), &tmp);
}
if (property_handlers.port.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.port.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_PORT), &tmp);
}
if (property_handlers.path.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.path.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_PATH), &tmp);
}
if (property_handlers.query.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.query.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_QUERY), &tmp);
}
if (property_handlers.fragment.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
if (parser->property_handlers.fragment.read_func(internal_uri, URI_COMPONENT_READ_RAW, &tmp) == SUCCESS) {
zend_hash_update(result, ZSTR_KNOWN(ZEND_STR_FRAGMENT), &tmp);
}

View File

@@ -64,17 +64,6 @@ typedef struct uri_property_handler_t {
uri_write_t write_func;
} uri_property_handler_t;
typedef struct uri_property_handlers_t {
uri_property_handler_t scheme;
uri_property_handler_t username;
uri_property_handler_t password;
uri_property_handler_t host;
uri_property_handler_t port;
uri_property_handler_t path;
uri_property_handler_t query;
uri_property_handler_t fragment;
} uri_property_handlers_t;
typedef struct uri_parser_t {
/**
* Name (the FQCN) of the URI parser. The "" name is reserved for the handler of the legacy parse_url().
@@ -138,7 +127,16 @@ typedef struct uri_parser_t {
*/
void (*free_uri)(void *uri);
const uri_property_handlers_t property_handlers;
struct {
uri_property_handler_t scheme;
uri_property_handler_t username;
uri_property_handler_t password;
uri_property_handler_t host;
uri_property_handler_t port;
uri_property_handler_t path;
uri_property_handler_t query;
uri_property_handler_t fragment;
} property_handlers;
} uri_parser_t;
typedef struct uri_internal_t {