mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Add request_parse_body() function
RFC: https://wiki.php.net/rfc/rfc1867-non-post This function allows populating the $_POST and $_FILES globals for non-post requests. This avoids manual parsing of RFC1867 requests. Fixes #55815 Closes GH-11472
This commit is contained in:
parent
2f894389b6
commit
cd66fcc68b
41 changed files with 995 additions and 45 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "php_content_types.h"
|
||||
#include "SAPI.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_exceptions.h"
|
||||
|
||||
/* for systems that need to override reading of environment variables */
|
||||
void _php_import_environment_variables(zval *array_ptr);
|
||||
|
@ -378,7 +379,7 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof)
|
|||
|
||||
static inline int add_post_vars(zval *arr, post_var_data_t *vars, bool eof)
|
||||
{
|
||||
uint64_t max_vars = PG(max_input_vars);
|
||||
uint64_t max_vars = REQUEST_PARSE_BODY_OPTION_GET(max_input_vars, PG(max_input_vars));
|
||||
|
||||
vars->ptr = ZSTR_VAL(vars->str.s);
|
||||
vars->end = ZSTR_VAL(vars->str.s) + ZSTR_LEN(vars->str.s);
|
||||
|
@ -538,8 +539,9 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
|
|||
}
|
||||
}
|
||||
|
||||
if (++count > PG(max_input_vars)) {
|
||||
php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
|
||||
zend_long max_input_vars = REQUEST_PARSE_BODY_OPTION_GET(max_input_vars, PG(max_input_vars));
|
||||
if (++count > max_input_vars) {
|
||||
php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", max_input_vars);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue