From 2b8d612ce4a3f62db7d585b35a176a524edb6bbf Mon Sep 17 00:00:00 2001
From: Thomas Schur <cyb10101@gmail.com>
Date: Wed, 17 May 2017 13:09:03 +0200
Subject: [PATCH] [BUGFIX] Prevent duplicated special char in backend
 breadcrumb

Prevent duplicated special char conversion of page title in
TYPO3 backend breadcrumb and fix title cropping

Resolves: #81242
Releases: master, 8.7
Change-Id: Id7710d8d8f79e20b20f43569558833d3d3f68f16
Reviewed-on: https://review.typo3.org/52820
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Template/Components/MetaInformation.php       | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Template/Components/MetaInformation.php b/typo3/sysext/backend/Classes/Template/Components/MetaInformation.php
index 634c8fd9f52d..6e0d52133814 100644
--- a/typo3/sysext/backend/Classes/Template/Components/MetaInformation.php
+++ b/typo3/sysext/backend/Classes/Template/Components/MetaInformation.php
@@ -123,13 +123,13 @@ class MetaInformation
     /**
      * Setting page title
      *
-     * @return string Record title
+     * @return string Record title, already htmlspecialchar()'ed
      */
     public function getRecordInformationTitle()
     {
         $recordInformations = $this->getRecordInformations();
         if (!empty($recordInformations)) {
-            $title = htmlspecialchars($recordInformations['title']);
+            $title = $recordInformations['title'];
         } else {
             $title = '';
         }
@@ -137,14 +137,7 @@ class MetaInformation
         // crop the title to title limit (or 50, if not defined)
         $beUser = $this->getBackendUser();
         $cropLength = empty($beUser->uc['titleLen']) ? 50 : $beUser->uc['titleLen'];
-        $croppedTitle = GeneralUtility::fixed_lgd_cs($title, $cropLength);
-        if ($croppedTitle !== $title) {
-            $recordInformationTitle = htmlspecialchars($croppedTitle);
-        } else {
-            $recordInformationTitle = htmlspecialchars($title);
-        }
-
-        return $recordInformationTitle;
+        return htmlspecialchars(GeneralUtility::fixed_lgd_cs($title, $cropLength));
     }
 
     /**
@@ -231,7 +224,7 @@ class MetaInformation
         return [
             'uid' => $uid,
             'icon' => $theIcon,
-            'title' => htmlspecialchars($title),
+            'title' => $title,
             'additionalInfo' => $additionalInfo
         ];
     }
-- 
GitLab