test if is_object before calling method_exists, fixes #2431

This commit is contained in:
Matthias Pigulla
2017-03-24 15:59:34 +01:00
parent c622995d6d
commit a5c2da6de0
+1 -1
View File
@@ -1425,7 +1425,7 @@ function twig_test_empty($value)
return 0 == count($value);
}
if (method_exists($value, '__toString')) {
if (is_object($value) && method_exists($value, '__toString')) {
return '' === (string) $value;
}