fix behaviour of HTTP/Request get

This commit is contained in:
msquare 2017-11-19 14:47:32 +01:00
parent 86e41e2949
commit f8807c4efb
2 changed files with 4 additions and 3 deletions

View File

@ -38,9 +38,9 @@ class Request extends SymfonyRequest
*/ */
public function has($key) public function has($key)
{ {
$value = $this->input($key); $value = $this->input($key, null);
return !empty($value); return !($value === null);
} }
/** /**

View File

@ -47,7 +47,8 @@ class RequestTest extends TestCase
]); ]);
$this->assertTrue($request->has('foo')); $this->assertTrue($request->has('foo'));
$this->assertFalse($request->has('bar')); $this->assertTrue($request->has('bar'));
$this->assertFalse($request->has('baz'));
} }
/** /**