Skip to content

Commit 26eac7d

Browse files
authored
uri: Clean up naming of public symbols (#19794)
* uri: Rename `uri_recomposition_mode_t` to `php_uri_recomposition_mode` * uri: Align the names of the `php_uri_recomposition_mode` values * uri: Rename `uri_component_read_mode_t` to `php_uri_component_read_mode` * uri: Align the names of the `php_uri_component_read_mode` values * uri: Rename `uri_property_name_t` to `php_uri_property_name` * uri: Align the names of the `php_uri_property_name` values * uri: Rename `uri_property_handler_t` to `php_uri_property_handler` * uri: Rename `uri_(read|write)_t` to `php_uri_property_handler_(read|write)` * uri: Rename `php_uri_property_handler`’s `(read|write)_func` to `read|write` The `_func` is implied by the data type and the name of the struct. * uri: Rename `uri_parser_t` to `php_uri_parser` * uri: Shorten the names of `php_uri_parser` fields The `_uri` suffix is implied, because this is an URI parser.
1 parent 9659f3e commit 26eac7d

18 files changed

+339
-339
lines changed

ext/filter/logical_filters.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,14 +612,14 @@ zend_result php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
612612
int parser_name_set;
613613
FETCH_STR_OPTION(parser_name, URL_OPTION_URI_PARSER_CLASS);
614614

615-
const uri_parser_t *uri_parser = php_uri_get_parser(parser_name_set ? parser_name : NULL);
615+
const php_uri_parser *uri_parser = php_uri_get_parser(parser_name_set ? parser_name : NULL);
616616
if (uri_parser == NULL) {
617617
zend_value_error("%s(): \"uri_parser_class\" option has invalid value", get_active_function_name());
618618
RETURN_VALIDATION_FAILED
619619
}
620620

621621
/* Parse the URI - if it fails, we return NULL */
622-
php_uri *uri = php_uri_parse_to_struct(uri_parser, Z_STRVAL_P(value), Z_STRLEN_P(value), URI_COMPONENT_READ_RAW, true);
622+
php_uri *uri = php_uri_parse_to_struct(uri_parser, Z_STRVAL_P(value), Z_STRLEN_P(value), PHP_URI_COMPONENT_READ_MODE_RAW, true);
623623
if (uri == NULL) {
624624
RETURN_VALIDATION_FAILED
625625
}

ext/openssl/xp_ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,7 @@ static char *php_openssl_get_url_name(const char *resourcename,
26342634
return NULL;
26352635
}
26362636

2637-
const uri_parser_t *uri_parser = php_stream_context_get_uri_parser("ssl", context);
2637+
const php_uri_parser *uri_parser = php_stream_context_get_uri_parser("ssl", context);
26382638
if (uri_parser == NULL) {
26392639
zend_value_error("%s(): Provided stream context has invalid value for the \"uri_parser_class\" option", get_active_function_name());
26402640
return NULL;
@@ -2647,7 +2647,7 @@ static char *php_openssl_get_url_name(const char *resourcename,
26472647

26482648
char * url_name = NULL;
26492649
zval host_zv;
2650-
zend_result result = php_uri_get_host(internal_uri, URI_COMPONENT_READ_RAW, &host_zv);
2650+
zend_result result = php_uri_get_host(internal_uri, PHP_URI_COMPONENT_READ_MODE_RAW, &host_zv);
26512651
if (result == SUCCESS && Z_TYPE(host_zv) == IS_STRING) {
26522652
const char * host = Z_STRVAL(host_zv);
26532653
size_t len = Z_STRLEN(host_zv);

ext/soap/php_http.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,12 @@ int make_http_soap_request(
431431
}
432432

433433
if (location != NULL && ZSTR_VAL(location)[0] != '\000') {
434-
const uri_parser_t *uri_parser = php_uri_get_parser(uri_parser_class);
434+
const php_uri_parser *uri_parser = php_uri_get_parser(uri_parser_class);
435435
if (uri_parser == NULL) {
436436
zend_argument_value_error(6, "must be a valid URI parser name");
437437
return FALSE;
438438
}
439-
uri = php_uri_parse_to_struct(uri_parser, ZSTR_VAL(location), ZSTR_LEN(location), URI_COMPONENT_READ_RAW, true);
439+
uri = php_uri_parse_to_struct(uri_parser, ZSTR_VAL(location), ZSTR_LEN(location), PHP_URI_COMPONENT_READ_MODE_RAW, true);
440440
}
441441

442442
tmp = Z_CLIENT_STREAM_CONTEXT_P(this_ptr);
@@ -1148,14 +1148,14 @@ int make_http_soap_request(
11481148
char *loc;
11491149

11501150
if ((loc = get_http_header_value(ZSTR_VAL(http_headers), "Location:")) != NULL) {
1151-
const uri_parser_t *uri_parser = php_uri_get_parser(uri_parser_class);
1151+
const php_uri_parser *uri_parser = php_uri_get_parser(uri_parser_class);
11521152
if (uri_parser == NULL) {
11531153
efree(loc);
11541154
zend_argument_value_error(6, "must be a valid URI parser name");
11551155
return FALSE;
11561156
}
11571157

1158-
php_uri *new_uri = php_uri_parse_to_struct(uri_parser, loc, strlen(loc), URI_COMPONENT_READ_RAW, true);
1158+
php_uri *new_uri = php_uri_parse_to_struct(uri_parser, loc, strlen(loc), PHP_URI_COMPONENT_READ_MODE_RAW, true);
11591159
efree(loc);
11601160

11611161
if (new_uri != NULL) {

ext/standard/ftp_fopen_wrapper.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
135135
char *transport;
136136
int transport_len;
137137

138-
const uri_parser_t *uri_parser = php_stream_context_get_uri_parser("ftp", context);
138+
const php_uri_parser *uri_parser = php_stream_context_get_uri_parser("ftp", context);
139139
if (uri_parser == NULL) {
140140
zend_value_error("%s(): Provided stream context has invalid value for the \"uri_parser_class\" option", get_active_function_name());
141141
return NULL;
142142
}
143143

144-
resource = php_uri_parse_to_struct(uri_parser, path, strlen(path), URI_COMPONENT_READ_RAW, true);
144+
resource = php_uri_parse_to_struct(uri_parser, path, strlen(path), PHP_URI_COMPONENT_READ_MODE_RAW, true);
145145
if (resource == NULL || resource->path == NULL) {
146146
if (resource && presource) {
147147
*presource = resource;
@@ -956,18 +956,18 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr
956956
int result;
957957
char tmp_line[512];
958958

959-
const uri_parser_t *uri_parser = php_stream_context_get_uri_parser("ftp", context);
959+
const php_uri_parser *uri_parser = php_stream_context_get_uri_parser("ftp", context);
960960
if (uri_parser == NULL) {
961961
zend_value_error("%s(): Provided stream context has invalid value for the \"uri_parser_class\" option", get_active_function_name());
962962
return 0;
963963
}
964964

965-
resource_from = php_uri_parse_to_struct(uri_parser, url_from, strlen(url_from), URI_COMPONENT_READ_RAW, true);
965+
resource_from = php_uri_parse_to_struct(uri_parser, url_from, strlen(url_from), PHP_URI_COMPONENT_READ_MODE_RAW, true);
966966
if (!resource_from) {
967967
return 0;
968968
}
969969

970-
resource_to = php_uri_parse_to_struct(uri_parser, url_to, strlen(url_to), URI_COMPONENT_READ_RAW, true);
970+
resource_to = php_uri_parse_to_struct(uri_parser, url_to, strlen(url_to), PHP_URI_COMPONENT_READ_MODE_RAW, true);
971971
if (!resource_to) {
972972
goto rename_errexit;
973973
}

ext/standard/http_fopen_wrapper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,12 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
393393
return NULL;
394394
}
395395

396-
const uri_parser_t *uri_parser = php_stream_context_get_uri_parser("http", context);
396+
const php_uri_parser *uri_parser = php_stream_context_get_uri_parser("http", context);
397397
if (uri_parser == NULL) {
398398
zend_value_error("%s(): Provided stream context has invalid value for the \"uri_parser_class\" option", get_active_function_name());
399399
return NULL;
400400
}
401-
resource = php_uri_parse_to_struct(uri_parser, path, strlen(path), URI_COMPONENT_READ_RAW, true);
401+
resource = php_uri_parse_to_struct(uri_parser, path, strlen(path), PHP_URI_COMPONENT_READ_MODE_RAW, true);
402402
if (resource == NULL) {
403403
return NULL;
404404
}
@@ -1097,7 +1097,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
10971097

10981098
php_uri_struct_free(resource);
10991099
/* check for invalid redirection URLs */
1100-
if ((resource = php_uri_parse_to_struct(uri_parser, new_path, strlen(new_path), URI_COMPONENT_READ_RAW, true)) == NULL) {
1100+
if ((resource = php_uri_parse_to_struct(uri_parser, new_path, strlen(new_path), PHP_URI_COMPONENT_READ_MODE_RAW, true)) == NULL) {
11011101
php_stream_wrapper_log_error(wrapper, options, "Invalid redirect URL! %s", new_path);
11021102
efree(new_path);
11031103
goto out;

0 commit comments

Comments
 (0)