From d77b3a45e4d220a09d6d0dacae89fe047020f708 Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Tue, 5 May 2020 21:59:43 +0200
Subject: [PATCH] [BUGFIX] Change 3rd argument of calls to callUserFunction()

The third argument of `GeneralUtility::callUserFunction` must be either
an object or null.
Ensure the argument is always null instead of false to avoid
triggering a deprecation log entry.

Resolves: #91184
Releases: master
Change-Id: I5ee0a58d812de737bd631e5c1986895e69c158af
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64415
Tested-by: Josef Glatz <josefglatz@gmail.com>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 typo3/sysext/core/Classes/LinkHandling/LinkService.php      | 2 +-
 .../core/Classes/TypoScript/Parser/TypoScriptParser.php     | 2 +-
 typo3/sysext/core/Classes/Utility/GeneralUtility.php        | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/core/Classes/LinkHandling/LinkService.php b/typo3/sysext/core/Classes/LinkHandling/LinkService.php
index f625c4dfecfb..8a1f6bd49b35 100644
--- a/typo3/sysext/core/Classes/LinkHandling/LinkService.php
+++ b/typo3/sysext/core/Classes/LinkHandling/LinkService.php
@@ -134,7 +134,7 @@ class LinkService implements SingletonInterface
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Link']['resolveByStringRepresentation'] ?? null)) {
                 $params = ['urn' => $urn, 'result' => &$result];
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['Link']['resolveByStringRepresentation'] as $hookMethod) {
-                    $fakeThis = false;
+                    $fakeThis = null;
                     GeneralUtility::callUserFunction($hookMethod, $params, $fakeThis);
                 }
             }
diff --git a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
index de5dd9f2c5a1..8773a718851e 100644
--- a/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
+++ b/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php
@@ -610,7 +610,7 @@ class TypoScriptParser
                 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsparser.php']['preParseFunc'][$modifierName])) {
                     $hookMethod = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsparser.php']['preParseFunc'][$modifierName];
                     $params = ['currentValue' => $currentValue, 'functionArgument' => $modifierArgument];
-                    $fakeThis = false;
+                    $fakeThis = null;
                     $newValue = GeneralUtility::callUserFunction($hookMethod, $params, $fakeThis);
                 } else {
                     self::getLogger()->warning('Missing function definition for ' . $modifierName . ' on TypoScript');
diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
index cf1a297da5c8..f91dcab93526 100644
--- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php
+++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
@@ -1691,7 +1691,7 @@ class GeneralUtility
      */
     public static function minifyJavaScript($script, &$error = '')
     {
-        $fakeThis = false;
+        $fakeThis = null;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['minifyJavaScript'] ?? [] as $hookMethod) {
             try {
                 $parameters = ['script' => $script];
@@ -3126,7 +3126,7 @@ class GeneralUtility
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Utility\GeneralUtility::class]['moveUploadedFile'] ?? null)) {
             $params = ['source' => $source, 'destination' => $destination, 'method' => 'upload_copy_move'];
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Utility\GeneralUtility::class]['moveUploadedFile'] as $hookMethod) {
-                $fakeThis = false;
+                $fakeThis = null;
                 self::callUserFunction($hookMethod, $params, $fakeThis);
             }
         }
@@ -3163,7 +3163,7 @@ class GeneralUtility
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Utility\GeneralUtility::class]['moveUploadedFile'] ?? null)) {
                 $params = ['source' => $uploadedFileName, 'destination' => $tempFile, 'method' => 'upload_to_tempfile'];
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Utility\GeneralUtility::class]['moveUploadedFile'] as $hookMethod) {
-                    $fakeThis = false;
+                    $fakeThis = null;
                     self::callUserFunction($hookMethod, $params, $fakeThis);
                 }
             }
-- 
GitLab