Implement Query Parameter Manipulation Support RFC#22551
Draft
kocsismate wants to merge 1 commit into
Draft
Conversation
TimWolla
reviewed
Jul 5, 2026
TimWolla
left a comment
Member
There was a problem hiding this comment.
Some comments without trying to understand the logic.
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'; |
Member
There was a problem hiding this comment.
I think this can also just be zend_string_init().
| } | ||
|
|
||
| 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
There was a problem hiding this comment.
This optimization is handled automatically:
Lines 104 to 113 in 8613e0e
| 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
There was a problem hiding this comment.
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: { |
Member
There was a problem hiding this comment.
Very inconsistent use of braces. They are not needed in the majority of cases.
| return NULL; | ||
| } | ||
| case IS_OBJECT: | ||
| if (Z_OBJCE_P(zv)->ce_flags & ZEND_ACC_ENUM && Z_OBJCE_P(zv)->enum_backing_type != IS_UNDEF) { |
Member
There was a problem hiding this comment.
Suggested change
| if (Z_OBJCE_P(zv)->ce_flags & ZEND_ACC_ENUM && Z_OBJCE_P(zv)->enum_backing_type != IS_UNDEF) { | |
| 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)) |
Member
There was a problem hiding this comment.
Is there a reason this isn't just?
Suggested change
| (value != NULL && list_entry->value != NULL && zend_string_equal_content(value, list_entry->value)) | |
| (value != NULL && list_entry->value != NULL && zend_string_equal(value, list_entry->value)) |
| return NULL; | ||
| } | ||
|
|
||
| php_uri_query_params_iterator *iterator = emalloc(sizeof(php_uri_query_params_iterator)); |
Member
There was a problem hiding this comment.
Suggested change
| php_uri_query_params_iterator *iterator = emalloc(sizeof(php_uri_query_params_iterator)); | |
| php_uri_query_params_iterator *iterator = emalloc(sizeof(*iterator)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC: https://wiki.php.net/rfc/query_params
Early preview yet -> a few leaks are to be fixed.