From f2c01238c66b6a2eff3accd50a288cb8443efdd1 Mon Sep 17 00:00:00 2001 From: Mohamed Said <themohamedsaid@gmail.com> Date: Mon, 30 Jan 2017 21:45:38 +0200 Subject: [PATCH] Fix parsing explicit rules --- src/Illuminate/Validation/ValidationRuleParser.php | 2 +- tests/Validation/ValidationValidatorTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Validation/ValidationRuleParser.php b/src/Illuminate/Validation/ValidationRuleParser.php index 2d4f49ce3ee3..e8c068f24a2d 100644 --- a/src/Illuminate/Validation/ValidationRuleParser.php +++ b/src/Illuminate/Validation/ValidationRuleParser.php @@ -151,7 +151,7 @@ protected function mergeRulesForAttribute($results, $attribute, $rules) $merge = head($this->explodeRules([$rules])); $results[$attribute] = array_merge( - isset($results[$attribute]) ? $results[$attribute] : [], $merge + isset($results[$attribute]) ? $this->explodeExplicitRule($results[$attribute]) : [], $merge ); return $results; diff --git a/tests/Validation/ValidationValidatorTest.php b/tests/Validation/ValidationValidatorTest.php index 2d8daa93ab67..ddda0b42bfcf 100755 --- a/tests/Validation/ValidationValidatorTest.php +++ b/tests/Validation/ValidationValidatorTest.php @@ -2639,6 +2639,9 @@ public function testImplicitEachWithAsterisksWithArrayValues() $v = new Validator($trans, ['foo' => [1, 2, 3, 4]], ['foo' => 'size:4']); $this->assertTrue($v->passes()); + $v = new Validator($trans, ['foo' => [1, 2, 3, 4]], ['foo.*' => 'integer', 'foo.0' => 'required']); + $this->assertTrue($v->passes()); + $v = new Validator($trans, ['foo' => [['bar' => [1, 2, 3]], ['bar' => [1, 2, 3]]]], ['foo.*.bar' => 'size:4']); $this->assertFalse($v->passes());