Skip to content

Commit

Permalink
Related to #2914, commit 9b927c4 improperly set the :value parameter.…
Browse files Browse the repository at this point in the history
… This fixes it.
  • Loading branch information
Woody Gilk committed Jun 23, 2010
1 parent 1108a33 commit 7e85602
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions classes/kohana/validate.php
Expand Up @@ -978,19 +978,19 @@ public function errors($file = NULL, $translate = TRUE)
}

// Start the translation values list
$values = array(':field' => $label);
$values = array(
':field' => $label,
':value' => $this[$field],
);

if ($params)
if (is_array($values[':value']))
{
// Value passed to the callback
$values[':value'] = array_shift($params);

if (is_array($values[':value']))
{
// All values must be strings
$values[':value'] = implode(', ', Arr::flatten($values[':value']));
}
// All values must be strings
$values[':value'] = implode(', ', Arr::flatten($values[':value']));
}

if ($params)
{
foreach ($params as $key => $value)
{
if (is_array($value))
Expand All @@ -1015,11 +1015,6 @@ public function errors($file = NULL, $translate = TRUE)
$values[':param'.($key + 1)] = $value;
}
}
else
{
// No value is present
$values[':value'] = NULL;
}

if ($message = Kohana::message($file, "{$field}.{$error}"))
{
Expand All @@ -1043,7 +1038,7 @@ public function errors($file = NULL, $translate = TRUE)
$message = "{$file}.{$field}.{$error}";
}

if ($translate == TRUE)
if ($translate)
{
if (is_string($translate))
{
Expand Down

0 comments on commit 7e85602

Please sign in to comment.