Skip to content

Commit

Permalink
Check the type of $message in Validation::errors() to prevent issues …
Browse files Browse the repository at this point in the history
…when a field name and rule are the same, fixes #4365
  • Loading branch information
Woody Gilk committed Dec 15, 2011
1 parent d8a36f6 commit fe38fe9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions classes/kohana/validation.php
Expand Up @@ -542,19 +542,19 @@ public function errors($file = NULL, $translate = TRUE)
}
}

if ($message = Kohana::message($file, "{$field}.{$error}"))
if ($message = Kohana::message($file, "{$field}.{$error}") AND is_string($message))
{
// Found a message for this field and error
}
elseif ($message = Kohana::message($file, "{$field}.default"))
elseif ($message = Kohana::message($file, "{$field}.default") AND is_string($message))
{
// Found a default message for this field
}
elseif ($message = Kohana::message($file, $error))
elseif ($message = Kohana::message($file, $error) AND is_string($message))
{
// Found a default message for this error
}
elseif ($message = Kohana::message('validation', $error))
elseif ($message = Kohana::message('validation', $error) AND is_string($message))
{
// Found a default message for this error
}
Expand Down

0 comments on commit fe38fe9

Please sign in to comment.