diff --git a/src/Illuminate/Support/MessageBag.php b/src/Illuminate/Support/MessageBag.php index ad422ebdb56a..575b8d1937b9 100755 --- a/src/Illuminate/Support/MessageBag.php +++ b/src/Illuminate/Support/MessageBag.php @@ -103,6 +103,10 @@ protected function isUnique($key, $message) */ public function has($key = null) { + if (is_null($key)) { + return $this->any(); + } + $keys = is_array($key) ? $key : func_get_args(); foreach ($keys as $key) { diff --git a/tests/Support/SupportMessageBagTest.php b/tests/Support/SupportMessageBagTest.php index 45611a2dfa96..7536c93b0ab6 100755 --- a/tests/Support/SupportMessageBagTest.php +++ b/tests/Support/SupportMessageBagTest.php @@ -72,6 +72,7 @@ public function testHasIndicatesExistence() $container->add('foo', 'bar'); $this->assertTrue($container->has('foo')); $this->assertFalse($container->has('bar')); + $this->assertTrue($container->has()); } public function testHasAnyIndicatesExistence()