From 6b8351f1b8ac9df229a0009cf6a1070a231136c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Tue, 19 Apr 2016 02:08:14 +0200 Subject: [PATCH 1/2] - Input class no longer tries to search for parameter in FILE or POST if it's not a postback. --- src/Pecee/Http/Input/Input.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Pecee/Http/Input/Input.php b/src/Pecee/Http/Input/Input.php index db45b00..4f0f7af 100644 --- a/src/Pecee/Http/Input/Input.php +++ b/src/Pecee/Http/Input/Input.php @@ -55,16 +55,18 @@ class Input { return $element; } - $element = $this->post->findFirst($index); + if(request()->getMethod() !== 'get') { - if($element !== null) { - return $element; - } + $element = $this->post->findFirst($index); - $element = $this->file->findFirst($index); + if ($element !== null) { + return $element; + } - if($element !== null) { - return $element; + $element = $this->file->findFirst($index); + if ($element !== null) { + return $element; + } } return $default; From f7af53a9af7438ee73c330f03382de90120aef51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Tue, 19 Apr 2016 14:48:26 +0200 Subject: [PATCH 2/2] - Optimized Input class to ensure that InputFile items are always returned as object as they contain no value. --- src/Pecee/Http/Input/Input.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Pecee/Http/Input/Input.php b/src/Pecee/Http/Input/Input.php index 4f0f7af..e0fafaa 100644 --- a/src/Pecee/Http/Input/Input.php +++ b/src/Pecee/Http/Input/Input.php @@ -87,6 +87,10 @@ class Input { if($item !== null) { + if($item instanceof InputFile) { + return $item; + } + if (is_array($item->getValue())) { return ($key !== null && isset($item->getValue()[$key])) ? $item->getValue()[$key] : $item->getValue(); }