diff --git a/src/functions.php b/src/functions.php index 1e9d044..7ec7d9f 100644 --- a/src/functions.php +++ b/src/functions.php @@ -91,15 +91,15 @@ function ensure_is_array($value) { * Get a specific configuration variable value * * @param mixed $value The value to cast - * @param string $type The type of expected value. The configuration variable - * value will be cast as this type. Could be : bool, int, - * float or string. + * @param string|null $type The type of expected value. The configuration variable + * value will be cast as this type. Could be : bool, int, + * float or string. * @param bool $split If true, $type=='array' and $value is a string, split * the value by comma (optional, default: false) * @return mixed The cast value **/ function cast($value, $type, $split=false) { - if (strpos($type, 'array_of_') === 0) { + if (is_string($type) && strpos($type, 'array_of_') === 0) { $type = substr($type, 9); $values = array(); foreach(ensure_is_array($value) as $key => $value)