From e6db83c97a865b74c12720d11ff6595988e9d4af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Thu, 29 Mar 2018 21:44:41 +0200 Subject: [PATCH] Fixed defaultValue issue in `getValue` method in `InputHandler` class. --- src/Pecee/Http/Input/InputHandler.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Pecee/Http/Input/InputHandler.php b/src/Pecee/Http/Input/InputHandler.php index 9b15a2a..051a187 100644 --- a/src/Pecee/Http/Input/InputHandler.php +++ b/src/Pecee/Http/Input/InputHandler.php @@ -244,12 +244,7 @@ class InputHandler public function getValue(string $index, ?string $defaultValue = null, ...$methods): ?string { $input = $this->get($index, $methods); - - if ($input !== null) { - return (trim($input->getValue()) === '') ? $defaultValue : $input->getValue(); - } - - return $input; + return ($input === null || ($input !== null && trim($input->getValue()) === '')) ? $defaultValue : $input->getValue(); } /**