Skip to content

Commit b6cb30b

Browse files
committed
Pass param to error messages during validation. Fixes #589
1 parent 488182a commit b6cb30b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

system/Validation/Validation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected function processRules(string $field, $value, $rules = null, array $dat
234234
// Set the error message if we didn't survive.
235235
if ($passed === false)
236236
{
237-
$this->errors[$field] = is_null($error) ? $this->getErrorMessage($rule, $field) : $error;
237+
$this->errors[$field] = is_null($error) ? $this->getErrorMessage($rule, $field, $param) : $error;
238238

239239
return false;
240240
}

tests/system/Validation/ValidationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ public function testGetErrors()
161161

162162
public function testGetErrorsWhenNone()
163163
{
164+
$_SESSION = [];
165+
164166
$data = [
165167
'foo' => 123,
166168
];

0 commit comments

Comments
 (0)