From 38ac27e2d216708c0baa644a167c343d8a423a0d Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Mon, 23 Mar 2020 14:21:40 +0100
Subject: [PATCH] [BUGFIX] Add more information to
 BackendUtility->preProcessValue hook

The hook BackendUtility->preProcessValue() needs more context for the
hooks to know what field/table/record is currently processed.

This is added as a stdObject now.

Resolves: #32169
Releases: master
Change-Id: I477d0ad61f0279165f81c772005fd2b3b0c3f0b2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63877
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
---
 typo3/sysext/backend/Classes/Utility/BackendUtility.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
index fdab29bbce09..cb2850b921ed 100644
--- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php
+++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php
@@ -1663,9 +1663,13 @@ class BackendUtility
         /*****************
          *HOOK: pre-processing the human readable output from a record
          ****************/
-        $null = null;
+        $referenceObject = new \stdClass();
+        $referenceObject->table = $table;
+        $referenceObject->fieldName = $col;
+        $referenceObject->uid = $uid;
+        $referenceObject->value = &$value;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['preProcessValue'] ?? [] as $_funcRef) {
-            GeneralUtility::callUserFunction($_funcRef, $theColConf, $null);
+            GeneralUtility::callUserFunction($_funcRef, $theColConf, $referenceObject);
         }
 
         $l = '';
-- 
GitLab