mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-10 23:42:12 +00:00
Bugfixes
This commit is contained in:
@@ -51,18 +51,17 @@ class Input
|
||||
}
|
||||
|
||||
/* Parse get requests */
|
||||
$this->file = $this->parseFiles();
|
||||
if (count($_FILES) > 0) {
|
||||
$this->file = $this->parseFiles();
|
||||
}
|
||||
}
|
||||
|
||||
public function parseFiles()
|
||||
{
|
||||
if (count($_FILES) === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$files = $_FILES;
|
||||
$list = [];
|
||||
|
||||
foreach ($_FILES as $key => $value) {
|
||||
foreach ($files as $key => $value) {
|
||||
|
||||
// Handle array input
|
||||
if (is_array($value['name']) === false) {
|
||||
@@ -95,7 +94,8 @@ class Input
|
||||
|
||||
$path = $original[$property];
|
||||
|
||||
foreach (array_values($index) as $i) {
|
||||
$tmp = array_values($index);
|
||||
foreach ($tmp as $i) {
|
||||
$path = $path[$i];
|
||||
}
|
||||
|
||||
|
||||
@@ -42,14 +42,13 @@ class InputFile implements IInputItem
|
||||
'error' => null,
|
||||
], $values);
|
||||
|
||||
$input = new static($values['index']);
|
||||
$input->setError($values['error'])
|
||||
return (new static($values['index']))
|
||||
->setError($values['error'])
|
||||
->setSize($values['size'])
|
||||
->setType($values['type'])
|
||||
->setTmpName($values['tmp_name'])
|
||||
->setFilename($values['name']);
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,7 +58,7 @@ class BaseCsrfVerifier implements IMiddleware
|
||||
public function handle(Request $request, ILoadableRoute &$route = null)
|
||||
{
|
||||
|
||||
if ($this->skip($request) === false && in_array($request->getMethod(), ['post', 'put', 'delete']) === true) {
|
||||
if ($this->skip($request) === false && in_array($request->getMethod(), ['post', 'put', 'delete'], false) === true) {
|
||||
|
||||
$token = $request->getInput()->get(static::POST_KEY, null, 'post');
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ class Request
|
||||
|
||||
public function __isset($name)
|
||||
{
|
||||
return $this->data[$name] ?? null;
|
||||
return array_key_exists($name, $this->data);
|
||||
}
|
||||
|
||||
public function __set($name, $value = null)
|
||||
|
||||
Reference in New Issue
Block a user