Browse Source

Fix unpack error in ValidationRule.

Refs #10682
mark_story 8 years ago
parent
commit
77209131ba

+ 1 - 1
src/Validation/ValidationRule.php

@@ -134,7 +134,7 @@ class ValidationRule
         }
 
         if ($this->_pass) {
-            $args = array_merge([$value], $this->_pass, [$context]);
+            $args = array_values(array_merge([$value], $this->_pass, [$context]));
             $result = $callable(...$args);
         } else {
             $result = $callable($value, $context);

+ 1 - 1
tests/TestCase/Validation/ValidationRuleTest.php

@@ -67,7 +67,7 @@ class ValidationRuleTest extends TestCase
         $Rule = new ValidationRule(['rule' => 'willFail']);
         $this->assertFalse($Rule->process($data, $providers, $context));
 
-        $Rule = new ValidationRule(['rule' => 'willPass']);
+        $Rule = new ValidationRule(['rule' => 'willPass', 'pass' => ['key' => 'value']]);
         $this->assertTrue($Rule->process($data, $providers, $context));
 
         $Rule = new ValidationRule(['rule' => 'willFail3']);