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) {
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;
}
}
+static zend_class_entry *php_http_params_class_entry;
+zend_class_entry *php_http_params_get_class_entry(void)
+{
+ return php_http_params_class_entry;
+}
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams___construct, 0, 0, 0)
ZEND_ARG_INFO(0, params)
ZEND_ARG_INFO(0, param_sep)
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z!/z/z/z/l", &zparams, ¶m_sep, &arg_sep, &val_sep, &flags), invalid_arg, return);
- zend_replace_error_handling(EH_THROW, php_http_exception_runtime_class_entry, &zeh);
+ zend_replace_error_handling(EH_THROW, php_http_get_exception_runtime_class_entry(), &zeh);
{
switch (ZEND_NUM_ARGS()) {
case 5:
EMPTY_FUNCTION_ENTRY
};
-zend_class_entry *php_http_params_class_entry;
-
PHP_MINIT_FUNCTION(http_params)
{
zend_class_entry ce = {0};