Skip to content

Commit d158e32

Browse files
committed
uri: Do not check the return value of uri_property_handler_from_internal_uri()
It's impossible for this function to return `NULL`, since it will always return a positive offset into a struct.
1 parent 04deb4d commit d158e32

File tree

2 files changed

+0
-5
lines changed

2 files changed

+0
-5
lines changed

ext/uri/php_uri.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ ZEND_ATTRIBUTE_NONNULL PHPAPI uri_internal_t *php_uri_parse(const php_uri_parser
127127
ZEND_ATTRIBUTE_NONNULL static zend_result php_uri_get_property(const uri_internal_t *internal_uri, php_uri_property_name property_name, php_uri_component_read_mode read_mode, zval *zv)
128128
{
129129
const php_uri_property_handler *property_handler = uri_property_handler_from_internal_uri(internal_uri, property_name);
130-
if (property_handler == NULL) {
131-
return FAILURE;
132-
}
133130

134131
return property_handler->read(internal_uri->uri, read_mode, zv);
135132
}

ext/uri/php_uri_common.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ void uri_read_component(INTERNAL_FUNCTION_PARAMETERS, php_uri_property_name prop
7373
URI_ASSERT_INITIALIZATION(internal_uri);
7474

7575
const php_uri_property_handler *property_handler = uri_property_handler_from_internal_uri(internal_uri, property_name);
76-
ZEND_ASSERT(property_handler != NULL);
7776

7877
if (UNEXPECTED(property_handler->read(internal_uri->uri, component_read_mode, return_value) == FAILURE)) {
7978
zend_throw_error(NULL, "The %s component cannot be retrieved", ZSTR_VAL(get_known_string_by_property_name(property_name)));
@@ -97,7 +96,6 @@ static void uri_write_component_ex(INTERNAL_FUNCTION_PARAMETERS, php_uri_propert
9796
RETVAL_OBJ(new_object);
9897

9998
const php_uri_property_handler *property_handler = uri_property_handler_from_internal_uri(internal_uri, property_name);
100-
ZEND_ASSERT(property_handler != NULL);
10199

102100
uri_internal_t *new_internal_uri = uri_internal_from_obj(new_object);
103101
URI_ASSERT_INITIALIZATION(new_internal_uri);

0 commit comments

Comments
 (0)