From 96ac7ba6c62169f48651ae897505ec8ef9865c2e Mon Sep 17 00:00:00 2001
From: Oliver Bartsch <bo@cedev.de>
Date: Mon, 29 Nov 2021 16:00:31 +0100
Subject: [PATCH] [!!!][TASK] Remove GeneralUtility::stdAuthCode

GeneralUtility::stdAuthCode is unused since at
least v9 and is therefore now removed.

Resolves: #96140
Related: #94309
Releases: main
Change-Id: Idc68fff1c946e7f2f30645a6a3510d95f8e272bf
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72375
Tested-by: core-ci <typo3@b13.com>
Tested-by: Nikita Hovratov <nikita.h@live.de>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 .../core/Classes/Utility/GeneralUtility.php   | 35 -------------------
 ...g-96107-DeprecatedFunctionalityRemoved.rst |  1 +
 .../Php/MethodCallStaticMatcher.php           |  1 +
 3 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
index 966f6c1f520e..65298a83b372 100644
--- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php
+++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
@@ -3015,41 +3015,6 @@ class GeneralUtility
         return $tempFileName;
     }
 
-    /**
-     * Standard authentication code (used in Direct Mail, checkJumpUrl and setfixed links computations)
-     *
-     * @param mixed $uid_or_record Uid (int) or record (array)
-     * @param string $fields List of fields from the record if that is given.
-     * @param int $codeLength Length of returned authentication code.
-     * @return string MD5 hash of 8 chars.
-     * @deprecated since v11, will be removed in v12.
-     */
-    public static function stdAuthCode($uid_or_record, $fields = '', $codeLength = 8)
-    {
-        trigger_error(
-            'GeneralUtility::stdAuthCode() is deprecated and will be removed in v12.',
-            E_USER_DEPRECATED
-        );
-
-        if (is_array($uid_or_record)) {
-            $recCopy_temp = [];
-            if ($fields) {
-                $fieldArr = self::trimExplode(',', $fields, true);
-                foreach ($fieldArr as $k => $v) {
-                    $recCopy_temp[$k] = $uid_or_record[$v];
-                }
-            } else {
-                $recCopy_temp = $uid_or_record;
-            }
-            $preKey = implode('|', $recCopy_temp);
-        } else {
-            $preKey = $uid_or_record;
-        }
-        $authCode = $preKey . '||' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
-        $authCode = substr(md5($authCode), 0, $codeLength);
-        return $authCode;
-    }
-
     /**
      * Responds on input localization setting value whether the page it comes from should be hidden if no translation exists or not.
      *
diff --git a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst
index bd6c64e14e24..340ed88069eb 100644
--- a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst
+++ b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst
@@ -41,6 +41,7 @@ The following PHP class methods that have previously been marked as deprecated f
 The following PHP static class methods that have previously been marked as deprecated for v11 and were now removed:
 
 - :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid()`
+- :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode()`
 
 The following methods changed signature according to previous deprecations in v11 at the end of the argument list:
 
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php
index ea70a66b5e7c..c782c9ac0bc0 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php
@@ -1085,6 +1085,7 @@ return [
         'maximumNumberOfArguments' => 3,
         'restFiles' => [
             'Deprecation-94309-DeprecatedGeneralUtilitystdAuthCode.rst',
+            'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3\CMS\Core\Utility\GeneralUtility::rmFromList' => [
-- 
GitLab