As the getSubject method may return a boolean, the toString method can throw an exception.
@@ -2530,6 +2530,10 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
*/
public function toString($object)
{
+ if (!is_object($object)) {
+ return '';
+ }
+
if (method_exists($object, '__toString')) {
return (string) $object;
}