kocsismate · GitHub

@kocsismate

@kocsismate

@kocsismate

@kocsismate

@kocsismate

@kocsismate kocsismate changed the title Implement Qquery Parameter Manipulation Support RFC Implement Query Parameter Manipulation Support RFC

Jul 2, 2026

TimWolla

Comment on lines +697 to +700

zend_string *result = zend_string_alloc(str_length, false);

memcpy(ZSTR_VAL(result), str, str_length);
ZSTR_VAL(result)[str_length] = '\0';
}

if (UNEXPECTED(str_length == 0)) {
return zend_empty_string;
}
} ZEND_HASH_FOREACH_END();

return buf.s != NULL ? smart_str_extract(&buf) : ZSTR_EMPTY_ALLOC();

Member

This optimization is handled automatically:

if (str->s) {
zend_string *res;
smart_str_0(str);
smart_str_trim_to_size_ex(str, persistent);
res = str->s;
str->s = NULL;
return res;
} else {
return ZSTR_EMPTY_ALLOC();
}
options->parsing_max_param_count = parsing_max_param_count;

if (true_value == NULL) {
options->true_value = zend_string_init(ZEND_STRL("1"), false);

Comment on lines +55 to +59

if (true_value == NULL) {
options->true_value = zend_string_init(ZEND_STRL("1"), false);
} else {
options->true_value = true_value;
}

Member

I feel this is more readable.

Suggested change

if (true_value == NULL) {
options->true_value = zend_string_init(ZEND_STRL("1"), false);
} else {
options->true_value = true_value;
}
if (true_value == NULL) {
true_value = ZSTR_CHAR('1');
}
options->true_value = true_value;
case IS_RESOURCE:
zend_argument_value_error(2, "must not contain a resource");
return NULL;
case IS_ARRAY: {
return NULL;
}
case IS_OBJECT:
if (Z_OBJCE_P(zv)->ce_flags & ZEND_ACC_ENUM && Z_OBJCE_P(zv)->enum_backing_type != IS_UNDEF) {

if (
(value == NULL && list_entry->value == NULL) ||
(value != NULL && list_entry->value != NULL && zend_string_equal_content(value, list_entry->value))
return NULL;
}

php_uri_query_params_iterator *iterator = emalloc(sizeof(php_uri_query_params_iterator));

Read the original on github.com ↗