mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 04:27:00 +00:00
test if is_object before calling method_exists, fixes #2431
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user