From e15360f9884d3ce363179d7ca3c433e19f1b6ec5 Mon Sep 17 00:00:00 2001 From: James Eagle Date: Tue, 14 Aug 2018 09:43:21 +0100 Subject: [PATCH] Check if value is a string --- src/ValueAs.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ValueAs.php b/src/ValueAs.php index ce6d4a5..f37cc08 100644 --- a/src/ValueAs.php +++ b/src/ValueAs.php @@ -22,14 +22,17 @@ public static function bool($value, $default = false) return $default; } - if(strcasecmp($value, 'true') === 0) + if(is_string($value)) { - return true; - } + if(strcasecmp($value, 'true') === 0) + { + return true; + } - if(strcasecmp($value, 'false') === 0) - { - return false; + if(strcasecmp($value, 'false') === 0) + { + return false; + } } return (bool)$value;