diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 8b3d1eead26a..210526a35cd7 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -38,7 +38,7 @@ class Application extends Container implements ApplicationContract, CachesConfig * * @var string */ - const VERSION = '10.8.0'; + const VERSION = '10.9.0'; /** * The base path for the Laravel installation. diff --git a/src/Illuminate/Foundation/Http/FormRequest.php b/src/Illuminate/Foundation/Http/FormRequest.php index 30412b6430f5..2a88d9c5c4a4 100644 --- a/src/Illuminate/Foundation/Http/FormRequest.php +++ b/src/Illuminate/Foundation/Http/FormRequest.php @@ -116,7 +116,7 @@ protected function getValidatorInstance() */ protected function createDefaultValidator(ValidationFactory $factory) { - $rules = $this->container->call([$this, 'rules']); + $rules = method_exists($this, 'rules') ? $this->container->call([$this, 'rules']) : []; $validator = $factory->make( $this->validationData(), $rules, diff --git a/tests/Foundation/FoundationFormRequestTest.php b/tests/Foundation/FoundationFormRequestTest.php index c1fa2f498b76..c2d7922a5518 100644 --- a/tests/Foundation/FoundationFormRequestTest.php +++ b/tests/Foundation/FoundationFormRequestTest.php @@ -204,6 +204,15 @@ public function after(InjectedDependency $dep) ], $messages); } + public function testRequestCanPassWithoutRulesMethod() + { + $request = $this->createRequest([], FoundationTestFormRequestWithoutRulesMethod::class); + + $request->validateResolved(); + + $this->assertEquals([], $request->all()); + } + /** * Catch the given exception thrown from the executor, and return it. * @@ -465,3 +474,11 @@ public function __construct(public $value) // } } + +class FoundationTestFormRequestWithoutRulesMethod extends FormRequest +{ + public function authorize() + { + return true; + } +}