diff --git a/lib/classes/Avatar.class.php b/lib/classes/Avatar.class.php
index f9866cf394029d0ef42a411f8fcace36919b4150..ac074d63cdd01dd24b474973822cf824fad74659 100644
--- a/lib/classes/Avatar.class.php
+++ b/lib/classes/Avatar.class.php
@@ -244,6 +244,11 @@ class Avatar {
             $opt['class'] = $this->getCssClass($size);
         }
 
+        // Apply cast to string for title if necessary
+        if (isset($opt['title']) && !is_string($opt['title'])) {
+            $opt['title'] = (string) $opt['title'];
+        }
+
         if (!empty($opt['title']) && $opt['title'] !== html_entity_decode($opt['title'])) {
             // Decode already htmlready encoded titles (which were used until
             // all attributes were encoded inside this method)