Fix 'Illegal offset type in isset or empty' warning when a param is an object.

Params can be any data type, but keys can only be integers or strings.
This commit is contained in:
Lane Roberts 2014-09-18 10:39:25 -05:00
parent 8f364b89a8
commit f8f1c0061b

View File

@ -992,7 +992,7 @@ class Validator
$i = 1;
foreach ($params as $k => $v) {
$tag = '{field'. $i .'}';
$label = isset($params[$k]) && !is_array($params[$k]) && isset($this->_labels[$params[$k]]) ? $this->_labels[$params[$k]] : $tag;
$label = isset($params[$k]) && (is_numeric($params[$k]) || is_string($params[$k])) && isset($this->_labels[$params[$k]]) ? $this->_labels[$params[$k]] : $tag;
$msg = str_replace($tag, $label, $msg);
$i++;
}