Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions ext/uri/php_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
22 changes: 10 additions & 12 deletions ext/uri/php_uri_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand Down Expand Up @@ -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 {
Expand Down