From 715d2c47358ecad1713239b1737e488d20e92390 Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Mon, 22 Nov 2021 11:42:32 +0100
Subject: [PATCH] [BUGFIX] Add missing checks for translate keys in compare
 view

The compare view of EXT:beuser does a couple
of f:translate calls with dynamic values as key.
Since some of those calls did not properly check
the provided key, before passing it to the view
helper, this previously led to exceptions.

This is now fixed by properly checking the
key, before passing it to the f:translate
view helper. Additionally, some defaults
are added to support static labels.

Resolves: #94202
Releases: master, 11.5
Change-Id: Iff14f7c3b17108288227b108b5005d28611e20a8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72248
Tested-by: core-ci <typo3@b13.com>
Tested-by: David Menzel <foxxdav@yahoo.de>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: David Menzel <foxxdav@yahoo.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
---
 .../Private/Partials/Compare/Information.html  | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/beuser/Resources/Private/Partials/Compare/Information.html b/typo3/sysext/beuser/Resources/Private/Partials/Compare/Information.html
index 302fc20894a9..3b93537a20ed 100644
--- a/typo3/sysext/beuser/Resources/Private/Partials/Compare/Information.html
+++ b/typo3/sysext/beuser/Resources/Private/Partials/Compare/Information.html
@@ -91,7 +91,12 @@
             <f:for each="{fileFolderPermissions}" as="item">
                 <tr>
                     <td class="col-icon"><core:icon identifier="{item.2}"/></td>
-                    <td class="col-title">{f:translate(key:item.0,default:item.1)}</td>
+                    <td class="col-title">
+                        <f:if condition="{item.0}">
+                            <f:then>{f:translate(key:item.0,default:item.0)}</f:then>
+                            <f:else>{item.1}</f:else>
+                        </f:if>
+                    </td>
                 </tr>
             </f:for>
         </table>
@@ -133,7 +138,9 @@
             <f:for each="{pageTypes}" as="item">
                 <tr>
                     <td class="col-icon"><core:icon identifier="{item.icon}"/></td>
-                    <td class="col-title">{f:translate(key:item.label,default:item.label)}</td>
+                    <td class="col-title">
+                        <f:if condition="{item.label}">{f:translate(key:item.label,default:item.label)}</f:if>
+                    </td>
                 </tr>
             </f:for>
         </table>
@@ -181,7 +188,7 @@
         <f:for each="{tables.all}" key="table" as="label">
             <tr>
                 <td class="col-title col-responsive nowrap">
-                    <f:if condition="{label}">{f:translate(key:label)}</f:if> [{table}]
+                    <f:if condition="{label}">{f:translate(key:label,default:label)}</f:if> [{table}]
                 </td>
                 <td class="text-center">
                     <bu:display.tableAccess table="{table}" select="{tables.tables_select}" modify="{tables.tables_modify}">
@@ -211,14 +218,13 @@
             <div class="panel panel-default">
                 <div class="panel-heading" role="tab" id="{tableName}-{id}-heading">
                     <a data-bs-toggle="collapse" title="{item.linkTitle}" href="#{tableName}-{id}" aria-expanded="false" aria-controls="{tableName}-{id}">
-                        <f:if condition="{table.label}">{f:translate(key:table.label)}</f:if> [{tableName}]
+                        <f:if condition="{table.label}">{f:translate(key:table.label,default:table.label)}</f:if> [{tableName}]
                     </a>
                 </div>
                 <div id="{tableName}-{id}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{tableName}-{id}-heading">
                         <div class="panel-body">
                             <f:for each="{table.fields}" as="label" key="field">
-                                        {f:translate(key:label)}
-                                        [{field}]<br>
+                                <f:if condition="{label}">{f:translate(key:label,default:label)}</f:if> [{field}]<br>
                             </f:for>
                         </div>
                 </div>
-- 
GitLab