From da066bc111944b04855ff237a46cad9aff5fff4c Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Fri, 17 Jun 2022 07:51:58 +0000
Subject: [PATCH] cast avatar title to string if necessary, fixes #1176

Closes #1176

Merge request studip/studip!697
---
 lib/classes/Avatar.class.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/classes/Avatar.class.php b/lib/classes/Avatar.class.php
index f9866cf3940..ac074d63cdd 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)
-- 
GitLab