Verify if a valid http query string after run parse_str.
This commit is contained in:
parent
595e9c1316
commit
d0d0d4dc76
@ -47,8 +47,9 @@ class Request extends Neuron {
|
||||
);
|
||||
else {
|
||||
$this->json = new Neuron();
|
||||
if (in_array($_SERVER['REQUEST_METHOD'], ['PUT', 'PATCH', 'DELETE'])) {
|
||||
parse_str(file_get_contents("php://input"), $input_vars);
|
||||
if (in_array($_SERVER['REQUEST_METHOD'], ['PUT', 'PATCH', 'DELETE']) &&
|
||||
preg_match('/^[^;?\/:@&=+$,]{1,255}[=]/', $this->body, $matches)) { // Con la expresión regular verificamos que sea un http query string válido y evitamos errores de memoria en caso de que el body tenga algo más grande que eso.
|
||||
parse_str($this->body, $input_vars);
|
||||
$this->{strtolower($_SERVER['REQUEST_METHOD'])} = new Neuron($input_vars);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user