bug #2433 Fix #2431 (mpdude)

This PR was merged into the 1.x branch.

Discussion
----------

Fix #2431

See title

Commits
-------

a5c2da6d test if is_object before calling method_exists, fixes #2431
This commit is contained in:
Fabien Potencier
2017-04-05 16:21:29 -07:00
+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;
}