Author: Richtermeister
Date: 2010-04-11 04:23:39 +0200 (Sun, 11 Apr 2010)
New Revision: 29071

Modified:
   plugins/sfErrorNotifierPlugin/trunk/lib/sfErrorNotifierMail.php
Log:
adding check for __toString method on objects in user attributes

Modified: plugins/sfErrorNotifierPlugin/trunk/lib/sfErrorNotifierMail.php
===================================================================
--- plugins/sfErrorNotifierPlugin/trunk/lib/sfErrorNotifierMail.php     
2010-04-10 23:10:19 UTC (rev 29070)
+++ plugins/sfErrorNotifierPlugin/trunk/lib/sfErrorNotifierMail.php     
2010-04-11 02:23:39 UTC (rev 29071)
@@ -128,25 +128,32 @@
 
        if (is_object($user))
        {
-               foreach ($user->getAttributeHolder()->getAll() as $key => 
$value)
-               {
-                       if (is_array($value))
-                       {
-                               $value = 'Array: ' . implode(', ',  $value);
-                       }
-                       $subtable[] = '<b>'.$key.'</b>: '.$value;
-               }
-       }
+      foreach ($user->getAttributeHolder()->getAll() as $key => $value)
+      {
+        if (is_array($value))
+        {
+          $value = 'Array: ' . implode(', ',  $value);
+        }
+        elseif(is_object($value))
+        {
+          if(!method_exists($value, "__toString"))
+          {
+            $value = "Object: ".get_class($value);
+          }
+        }
+        $subtable[] = '<b>'.$key.'</b>: '.$value;
+      }
+    }
 
-       $subtable = implode('<br/>',$subtable);
-    
-       $this->addRow('Attributes',$subtable);
-       $this->addRow('Credentials',implode(', ',$user->listCredentials()));
+    $subtable = implode('<br/>',$subtable);
+
+    $this->addRow('Attributes',$subtable);
+    $this->addRow('Credentials',implode(', ',$user->listCredentials()));
     $this->body .= '</table>';
-    
-       
+
+
     $this->body .= '</div>';
-    
+
     @mail($this->to, $this->subject, $this->body, $this->headers);
 
     return true;

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to