From f8f1c0061bcfd5c64fd8d60c6487efa70c3b1130 Mon Sep 17 00:00:00 2001 From: Lane Roberts Date: Thu, 18 Sep 2014 10:39:25 -0500 Subject: [PATCH] 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. --- src/Valitron/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Valitron/Validator.php b/src/Valitron/Validator.php index e6b7e16..08b6e58 100644 --- a/src/Valitron/Validator.php +++ b/src/Valitron/Validator.php @@ -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++; }