if (flags & PHP_HTTP_PARAMS_ESCAPED) {
sanitize_escaped(zv);
}
-
+
if (!Z_STRLEN_P(zv)) {
return;
}
- eos = &Z_STRVAL_P(zv)[Z_STRLEN_P(zv)-1];
- if (*eos == '*') {
- *eos = '\0';
- *rfc5987 = 1;
- Z_STRLEN_P(zv) -= 1;
+ if (flags & PHP_HTTP_PARAMS_RFC5987) {
+ eos = &Z_STRVAL_P(zv)[Z_STRLEN_P(zv)-1];
+ if (*eos == '*') {
+ *eos = '\0';
+ *rfc5987 = 1;
+ Z_STRLEN_P(zv) -= 1;
+ }
}
if (flags & PHP_HTTP_PARAMS_URLENCODED) {
zval *test_ptr;
while (Z_TYPE_P(zdata_ptr) == IS_ARRAY && (test_ptr = zend_hash_get_current_data(Z_ARRVAL_P(zdata_ptr)))) {
- if (Z_TYPE_P(test_ptr) == IS_ARRAY) {
+ if (Z_TYPE_P(test_ptr) == IS_ARRAY && Z_TYPE_P(ptr) == IS_ARRAY) {
zval *tmp_ptr = ptr;
/* now find key in ptr */
static void push_param(HashTable *params, php_http_params_state_t *state, const php_http_params_opts_t *opts)
{
if (state->val.str) {
- if (0 < (state->val.len = state->input.str - state->val.str)) {
+ if (!state->current.val) {
+ return;
+ } else if (0 < (state->val.len = state->input.str - state->val.str)) {
sanitize_value(opts->flags, state->val.str, state->val.len, state->current.val, state->rfc5987);
+ } else {
+ ZVAL_EMPTY_STRING(state->current.val);
}
state->rfc5987 = 0;
} else if (state->arg.str) {
if (state->quotes || state->escape) {
return 0;
}
-
+
if (sep) while (*sep) {
if (check_str(state->input.str, state->input.len, (*sep)->str, (*sep)->len)) {
return (*sep)->len;
} else {
state.escape = (*state.input.str == '\\');
}
-
+
if (!state.param.str) {
/* initialize */
skip_sep(0, &state, opts->param, opts->arg, opts->val);
}
}
}
-
+
if (state.input.len) {
++state.input.str;
--state.input.len;