Переглянути джерело

Update Admin toString method

As the getSubject method may return a boolean, the toString method can throw an exception.
Emmanuel Vella 12 роки тому
батько
коміт
c9f7ef8951
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      Admin/Admin.php

+ 4 - 0
Admin/Admin.php

@@ -2530,6 +2530,10 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
      */
      */
     public function toString($object)
     public function toString($object)
     {
     {
+        if (!is_object($object)) {
+            return '';
+        }
+
         if (method_exists($object, '__toString')) {
         if (method_exists($object, '__toString')) {
             return (string) $object;
             return (string) $object;
         }
         }