diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index bd54885d9d1b..8b4ef40901d7 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -179,12 +179,13 @@ public static function camel($value) */ public static function contains($haystack, $needles) { - foreach ((array) $needles as $needle) { - if ($needle !== '' && mb_strpos($haystack, $needle) !== false) { - return true; + if($haystack !== null && is_string($haystack)){ + foreach ((array) $needles as $needle) { + if ($needle !== '' && mb_strpos($haystack, $needle) !== false) { + return true; + } } } - return false; }