From 81d80f856954ff90ee0d9b3fd0fbb2feeeaf1816 Mon Sep 17 00:00:00 2001
From: Markus Klein <markus.klein@typo3.org>
Date: Thu, 10 Nov 2016 23:02:42 +0100
Subject: [PATCH] [BUGFIX] Do not add empty alert fieldChangeFunc to link
 browser URL

Adding an empty alert message to the fieldChangeFunc array causes
the fieldChangeFunc_hash to mismatch when pagination or search
is used in the link browser popup.

Add a check for an empty value, which is already present in another
place in Core.

Resolves: #75743
Releases: master, 7.6
Change-Id: I1a15400960d577c1a2a0a905643b56533d957100
Reviewed-on: https://review.typo3.org/50586
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
---
 .../backend/Classes/Form/Container/SingleFieldContainer.php   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php b/typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php
index 76fbe2b3341c..8b570114c931 100644
--- a/typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php
+++ b/typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php
@@ -152,7 +152,9 @@ class SingleFieldContainer extends AbstractContainer
         // JavaScript code for event handlers:
         $parameterArray['fieldChangeFunc'] = [];
         $parameterArray['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = 'TBE_EDITOR.fieldChanged(' . GeneralUtility::quoteJSvalue($table) . ',' . GeneralUtility::quoteJSvalue($row['uid']) . ',' . GeneralUtility::quoteJSvalue($fieldName) . ',' . GeneralUtility::quoteJSvalue($parameterArray['itemFormElName']) . ');';
-        $parameterArray['fieldChangeFunc']['alert'] = $alertMsgOnChange;
+        if ($alertMsgOnChange) {
+            $parameterArray['fieldChangeFunc']['alert'] = $alertMsgOnChange;
+        }
 
         // If this is the child of an inline type and it is the field creating the label
         if ($this->isInlineChildAndLabelField($table, $fieldName)) {
-- 
GitLab