[TASK] Remove reqCHash functionality for plugins 67/62267/9
authorBenni Mack <benni@typo3.org>
Sat, 9 Nov 2019 21:48:22 +0000 (22:48 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Fri, 6 Dec 2019 20:58:17 +0000 (21:58 +0100)
Since TYPO3 v10.0, all links generated by TYPO3 contain
a cHash if
- there are arguments that are not mapped within the routing
- there are arguments that are not explicitly "excluded" from cHash (e.g. fbclid)
- there are arguments that are not internal (L,id,MP).

The PageArgumentValidator middleware now always evaluates the
arguments properly at every request and decides to disable
caching or throw a 404, if an incoming request does not have
a cHash or an invalid cHash.

Through the middleware, any plugin is automatically checked
for the cHash, and it does not matter anymore for plugins,
so it does not matter for integrators or template authors as well
as cHash is managed internally by TYPO3 Core now (with no way
to disable it, for security reasons).

All functionality regarding cHash that can be dropped:
- CacheHashEnforcer and Extbase option
- TSFE->reqCHash() can be marked as deprecated
- the option within PiBased Plugins is now irrelevant as well.

This change jointly decouples cHash evaluation from any other
part than Url Generation (= PageRouter) and Resolver (PageArgumentValidator),
finally streamlining all logic of cHash functionality.

Resolves: #89868
Releases: master
Change-Id: I7a694fbc95fa1ea4dc85b12a94b0a06b3722fd11
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62267
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog <look@susi.dev>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Susanne Moog <look@susi.dev>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
13 files changed:
typo3/sysext/core/Documentation/Changelog/master/Deprecation-89868-RemoveReqCHashFunctionalityForPlugins.rst [new file with mode: 0644]
typo3/sysext/extbase/Classes/Mvc/Web/CacheHashEnforcer.php [deleted file]
typo3/sysext/extbase/Classes/Mvc/Web/FrontendRequestHandler.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/CacheHashEnforcerTest.php [deleted file]
typo3/sysext/extbase/ext_typoscript_setup.typoscript
typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php
typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php
typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php
typo3/sysext/frontend/Tests/UnitDeprecated/Controller/TypoScriptFrontendControllerTest.php [new file with mode: 0644]
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89868-RemoveReqCHashFunctionalityForPlugins.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-89868-RemoveReqCHashFunctionalityForPlugins.rst
new file mode 100644 (file)
index 0000000..f0b885f
--- /dev/null
@@ -0,0 +1,61 @@
+.. include:: ../../Includes.txt
+
+===============================================================
+Deprecation: #89868 - Remove reqCHash functionality for plugins
+===============================================================
+
+See :issue:`89868`
+
+Description
+===========
+
+Extbase and pi-based plugins that are non-cacheable could previously
+require the validation of the cHash GET parameter
+in order to validate GET parameters against the "cHash".
+
+In Extbase plugins, this could be configured via a TypoScript feature toggle (enabled by default):
+
+:typoscript:`config.tx_extbase.features.requireCHashArgumentForActionArguments = 1`
+
+In Pi-based plugins the public property :php:`AbstractPlugin->pi_checkCHash` 
+was used to enable the cHash validation for non-cacheable plugins.
+
+Both plugin systems triggered the method :php:`TypoScriptFrontendController->reqCHash` which 
+validated relevant GET parameters. However, the `PageArgumentValidator` PSR-15 middleware now 
+always validates the cHash, so a plugin does not need to know about cHash validation anymore and 
+therefor does not need to set the option.
+
+This means the options are not needed anymore, as the validation already happens during the Frontend
+request handling process. The options are removed.
+
+In addition, the method :php:`TypoScriptFrontendController->reqCHash()` is marked as deprecated and 
+not in use anymore.
+
+
+Impact
+======
+
+Setting the options in Extbase or Pi-Base have no effect anymore.
+
+Calling the PHP method :php:`TypoScriptFrontendController->reqCHash()`
+will trigger a deprecation warning.
+
+Internal classes such as the `CacheHashEnforcer` are removed.
+
+
+Affected Installations
+======================
+
+TYPO3 installations with plugins, where one of the options is set,
+or where the PHP method is called directly.
+
+
+Migration
+=========
+
+Remove the options / flags as they have no effect in TYPO3 v10 anymore.
+
+Calling the method directly is also not needed, as the PageArgumentValidator is executing this 
+validation now at every request.
+
+.. index:: Frontend, PartiallyScanned, ext:frontend
diff --git a/typo3/sysext/extbase/Classes/Mvc/Web/CacheHashEnforcer.php b/typo3/sysext/extbase/Classes/Mvc/Web/CacheHashEnforcer.php
deleted file mode 100644 (file)
index 35b6800..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Extbase\Mvc\Web;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Core\SingletonInterface;
-use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
-use TYPO3\CMS\Frontend\Page\CacheHashCalculator;
-
-/**
- * Enforces cHash argument if it is required for a given request
- * @internal only to be used within Extbase, not part of TYPO3 Core API.
- */
-class CacheHashEnforcer implements SingletonInterface
-{
-    /**
-     * @var CacheHashCalculator
-     */
-    protected $cacheHashCalculator;
-
-    /**
-     * @var TypoScriptFrontendController
-     */
-    protected $typoScriptFrontendController;
-
-    /**
-     * CacheHashEnforcer constructor.
-     *
-     * @param CacheHashCalculator $cacheHashCalculator
-     * @param TypoScriptFrontendController|null $typoScriptFrontendController
-     */
-    public function __construct(
-        CacheHashCalculator $cacheHashCalculator,
-        TypoScriptFrontendController $typoScriptFrontendController = null
-    ) {
-        $this->cacheHashCalculator = $cacheHashCalculator;
-        $this->typoScriptFrontendController = $typoScriptFrontendController ?: $GLOBALS['TSFE'];
-    }
-
-    /**
-     * Checks if cHash is required for the current request and calls
-     * TypoScriptFrontendController::reqCHash() if so.
-     * This call will trigger a PageNotFoundException if arguments are required and cHash is not present.
-     *
-     * @param Request $request
-     * @param string $pluginNamespace
-     */
-    public function enforceForRequest(Request $request, string $pluginNamespace)
-    {
-        $arguments = $request->getArguments();
-        if (is_array($arguments) && count($arguments) > 0) {
-            $parameters = [$pluginNamespace => $arguments];
-            $parameters['id'] = $this->typoScriptFrontendController->id;
-            $relevantParameters = $this->cacheHashCalculator->getRelevantParameters(
-                http_build_query($parameters, '', '&', PHP_QUERY_RFC3986)
-            );
-            if (count($relevantParameters) > 0) {
-                $this->typoScriptFrontendController->reqCHash();
-            }
-        }
-    }
-}
index 267b743..2aef48c 100644 (file)
@@ -31,11 +31,6 @@ class FrontendRequestHandler extends AbstractRequestHandler
     protected $extensionService;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer
-     */
-    protected $cacheHashEnforcer;
-
-    /**
      * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
      */
     public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
@@ -52,14 +47,6 @@ class FrontendRequestHandler extends AbstractRequestHandler
     }
 
     /**
-     * @param \TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer $cacheHashEnforcer
-     */
-    public function injectCacheHashEnforcer(\TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer $cacheHashEnforcer)
-    {
-        $this->cacheHashEnforcer = $cacheHashEnforcer;
-    }
-
-    /**
      * Handles the web request. The response will automatically be sent to the client.
      *
      * @return \TYPO3\CMS\Extbase\Mvc\ResponseInterface|null
@@ -80,11 +67,7 @@ class FrontendRequestHandler extends AbstractRequestHandler
         }
 
         if ($this->configurationManager->isFeatureEnabled('requireCHashArgumentForActionArguments')) {
-            $pluginNamespace = $this->extensionService->getPluginNamespace(
-                $request->getControllerExtensionName(),
-                $request->getPluginName()
-            );
-            $this->cacheHashEnforcer->enforceForRequest($request, $pluginNamespace);
+            trigger_error('The option requireCHashArgumentForActionArguments is removed', E_USER_DEPRECATED);
         }
 
         /** @var \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response */
diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Web/CacheHashEnforcerTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Web/CacheHashEnforcerTest.php
deleted file mode 100644 (file)
index b8eabdd..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\Web;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer;
-use TYPO3\CMS\Extbase\Mvc\Web\Request;
-use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
-use TYPO3\CMS\Frontend\Page\CacheHashCalculator;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Test case
- */
-class CacheHashEnforcerTest extends UnitTestCase
-{
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer
-     */
-    protected $subject;
-
-    /**
-     * @var TypoScriptFrontendController|\PHPUnit\Framework\MockObject\MockObject
-     */
-    protected $frontendControllerMock;
-
-    protected function setUp(): void
-    {
-        parent::setUp();
-        $this->frontendControllerMock = $this->getMockBuilder(TypoScriptFrontendController::class)->disableOriginalConstructor()->getMock();
-        $this->frontendControllerMock->id = 42;
-        $cacheHashCalculator = new CacheHashCalculator();
-        $this->subject = new CacheHashEnforcer(
-            $cacheHashCalculator,
-            $this->frontendControllerMock
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function validateCallsReqCHashIfRequestArgumentsArePresent()
-    {
-        $request = new Request();
-        $request->setArguments(['foo' => 'bar']);
-        $this->frontendControllerMock
-            ->expects(self::once())
-            ->method('reqCHash');
-
-        $this->subject->enforceForRequest($request, 'tx_foo');
-    }
-
-    /**
-     * @test
-     */
-    public function validateDoesNotCallsReqCHashIfNoRequestArgumentsArePresent()
-    {
-        $request = new Request();
-        $this->frontendControllerMock
-            ->expects(self::never())
-            ->method('reqCHash');
-
-        $this->subject->enforceForRequest($request, 'tx_foo');
-    }
-}
index f4ccfdf..8348d38 100644 (file)
@@ -11,7 +11,5 @@ config.tx_extbase {
                skipDefaultArguments = 0
                # if set to 1, the enable fields are ignored in BE context
                ignoreAllEnableFieldsInBe = 0
-               # Should be on by default, but can be disabled if all action in the plugin are uncached
-               requireCHashArgumentForActionArguments = 1
        }
 }
index 6ea5b75..b8bfd10 100644 (file)
@@ -53,16 +53,6 @@ class FrontendLoginController extends AbstractPlugin
     public $extKey = 'felogin';
 
     /**
-     * @var bool
-     */
-    public $pi_checkCHash = false;
-
-    /**
-     * @var bool
-     */
-    public $pi_USER_INT_obj = true;
-
-    /**
      * Is user logged in?
      *
      * @var bool
index d25d5e8..4aa63df 100644 (file)
@@ -1729,10 +1729,11 @@ class TypoScriptFrontendController implements LoggerAwareInterface
      * Will disable caching if the cHash value was not set when having dynamic arguments in GET query parameters.
      * This function should be called to check the _existence_ of "&cHash" whenever a plugin generating cacheable output is using extra GET variables. If there _is_ a cHash value the validation of it automatically takes place in makeCacheHash() (see above)
      *
-     * @see \TYPO3\CMS\Frontend\Plugin\AbstractPlugin::pi_cHashCheck()
+     * @deprecated since TYPO3 v10.2, will be removed in TYPO3 v11. The PSR-15 middleware PageArgumentValidator is already taking care of this.
      */
     public function reqCHash()
     {
+        trigger_error('TypoScriptFrontendController->reqCHash() is not needed anymore, as all functionality is handled via the PSR-15 PageArgumentValidator middleware already.', E_USER_DEPRECATED);
         if (!empty($this->pageArguments->getArguments()['cHash']) || empty($this->pageArguments->getDynamicArguments())) {
             return;
         }
index 4b6d2aa..66ce127 100644 (file)
@@ -28,7 +28,6 @@ use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Frontend\Controller\ErrorController;
-use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\CMS\Frontend\Page\CacheHashCalculator;
 use TYPO3\CMS\Frontend\Page\PageAccessFailureReasons;
 
@@ -148,7 +147,6 @@ class PageArgumentValidator implements MiddlewareInterface, LoggerAwareInterface
      * Calculates a hash string based on additional parameters in the url.
      * This is used to cache pages with more parameters than just id and type.
      *
-     * @see TypoScriptFrontendController::reqCHash()
      * @param string $cHash the chash to check
      * @param array $relevantParameters GET parameters necessary for cHash calculation
      * @param bool $pageNotFoundOnCacheHashError see $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError']
index 38ad77c..0241b49 100644 (file)
@@ -184,23 +184,6 @@ class AbstractPlugin
     public $pi_autoCacheEn = false;
 
     /**
-     * If set, then links are
-     * 1) not using cHash and
-     * 2) not allowing pages to be cached. (Set this for all USER_INT plugins!)
-     *
-     * @var bool
-     */
-    public $pi_USER_INT_obj = false;
-
-    /**
-     * If set, then caching is disabled if piVars are incoming while
-     * no cHash was set (Set this for all USER plugins!)
-     *
-     * @var bool
-     */
-    public $pi_checkCHash = false;
-
-    /**
      * Should normally be set in the main function with the TypoScript content passed to the method.
      *
      * $conf[LOCAL_LANG][_key_] is reserved for Local Language overrides.
@@ -249,18 +232,6 @@ class AbstractPlugin
         // Setting piVars:
         if ($this->prefixId) {
             $this->piVars = GeneralUtility::_GPmerged($this->prefixId);
-            // cHash mode check
-            // IMPORTANT FOR CACHED PLUGINS (USER cObject): As soon as you generate cached plugin output which
-            // depends on parameters (eg. seeing the details of a news item) you MUST check if a cHash value is set.
-            // Background: The function call will check if a cHash parameter was sent with the URL because only if
-            // it was the page may be cached. If no cHash was found the function will simply disable caching to
-            // avoid unpredictable caching behaviour. In any case your plugin can generate the expected output and
-            // the only risk is that the content may not be cached. A missing cHash value is considered a mistake
-            // in the URL resulting from either URL manipulation, "realurl" "grayzones" etc. The problem is rare
-            // (more frequent with "realurl") but when it occurs it is very puzzling!
-            if ($this->pi_checkCHash && !empty($this->piVars)) {
-                $this->frontendController->reqCHash();
-            }
         }
         $this->LLkey = $this->frontendController->getLanguage()->getTypo3Language();
 
@@ -401,8 +372,10 @@ class AbstractPlugin
     public function pi_linkTP($str, $urlParameters = [], $cache = false, $altPageId = 0)
     {
         $conf = [];
-        $conf['no_cache'] = $this->pi_USER_INT_obj ? 0 : !$cache;
-        $conf['parameter'] = $altPageId ?: ($this->pi_tmpPageId ?: $this->frontendController->id);
+        if (!$cache) {
+            $conf['no_cache'] = true;
+        }
+        $conf['parameter'] = $altPageId ?: ($this->pi_tmpPageId ?: 'current');
         $conf['additionalParams'] = $this->conf['parent.']['addParams'] . HttpUtility::buildQueryString($urlParameters, '&', true) . $this->pi_moreParams;
         return $this->cObj->typoLink($str, $conf);
     }
index e43f61e..10cf36c 100644 (file)
@@ -19,7 +19,6 @@ use TYPO3\CMS\Core\Cache\Backend\NullBackend;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Domain\Repository\PageRepository;
-use TYPO3\CMS\Core\Http\ImmediateResponseException;
 use TYPO3\CMS\Core\Http\ServerRequest;
 use TYPO3\CMS\Core\Http\ServerRequestFactory;
 use TYPO3\CMS\Core\Http\Uri;
@@ -553,81 +552,4 @@ class TypoScriptFrontendControllerTest extends UnitTestCase
         // since PageRenderer is a singleton, this can be queried via the makeInstance call
         self::assertEquals('fr', $languageService->lang);
     }
-
-    public function requireCacheHashValidateRelevantParametersDataProvider(): array
-    {
-        return [
-            'no extra params' => [
-                [],
-                false,
-            ],
-            'with required param' => [
-                [
-                    'abc' => 1,
-                ],
-                true,
-            ],
-            'with required params' => [
-                [
-                    'abc' => 1,
-                    'abcd' => 1,
-                ],
-                true,
-            ],
-            'with not required param' => [
-                [
-                    'fbclid' => 1,
-                ],
-                false,
-            ],
-            'with not required params' => [
-                [
-                    'fbclid' => 1,
-                    'gclid' => 1,
-                    'foo' => [
-                        'bar' => 1,
-                    ],
-                ],
-                false,
-            ],
-            'with combined params' => [
-                [
-                    'abc' => 1,
-                    'fbclid' => 1,
-                ],
-                true,
-            ],
-            'with multiple combined params' => [
-                [
-                    'abc' => 1,
-                    'fbclid' => 1,
-                    'abcd' => 1,
-                    'gclid' => 1
-                ],
-                true,
-            ]
-        ];
-    }
-
-    /**
-     * @test
-     *
-     * @dataProvider requireCacheHashValidateRelevantParametersDataProvider
-     * @param array $remainingArguments
-     * @param bool $expected
-     */
-    public function requireCacheHashValidateRelevantParameters(array $remainingArguments, bool $expected): void
-    {
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError'] = true;
-        $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] = ['gclid', 'fbclid', 'foo[bar]'];
-
-        $this->subject = $this->getAccessibleMock(TypoScriptFrontendController::class, ['dummy'], [], '', false);
-        $this->subject->_set('pageArguments', new PageArguments(1, '0', ['tx_test' => 1], ['tx_test' => 1], $remainingArguments));
-
-        if ($expected) {
-            static::expectException(ImmediateResponseException::class);
-        }
-        $this->subject->reqCHash();
-    }
 }
diff --git a/typo3/sysext/frontend/Tests/UnitDeprecated/Controller/TypoScriptFrontendControllerTest.php b/typo3/sysext/frontend/Tests/UnitDeprecated/Controller/TypoScriptFrontendControllerTest.php
new file mode 100644 (file)
index 0000000..858bcab
--- /dev/null
@@ -0,0 +1,132 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Frontend\Tests\UnitDeprecated\Controller;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Context\Context;
+use TYPO3\CMS\Core\Domain\Repository\PageRepository;
+use TYPO3\CMS\Core\Http\ImmediateResponseException;
+use TYPO3\CMS\Core\Http\ServerRequest;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Routing\PageArguments;
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
+
+/**
+ * Test case
+ */
+class TypoScriptFrontendControllerTest extends UnitTestCase
+{
+    /**
+     * @var bool Reset singletons created by subject
+     */
+    protected $resetSingletonInstances = true;
+
+    /**
+     * @var \PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|TypoScriptFrontendController
+     */
+    protected $subject;
+
+    protected function setUp(): void
+    {
+        parent::setUp();
+        $this->subject = $this->getAccessibleMock(TypoScriptFrontendController::class, ['dummy'], [], '', false);
+        $this->subject->_set('context', new Context());
+        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '170928423746123078941623042360abceb12341234231';
+
+        $pageRepository = $this->getMockBuilder(PageRepository::class)->getMock();
+        $this->subject->sys_page = $pageRepository;
+
+        $pageRenderer = $this->getMockBuilder(PageRenderer::class)->getMock();
+        $this->subject->_set('pageRenderer', $pageRenderer);
+    }
+
+    public function requireCacheHashValidateRelevantParametersDataProvider(): array
+    {
+        return [
+            'no extra params' => [
+                [],
+                false,
+            ],
+            'with required param' => [
+                [
+                    'abc' => 1,
+                ],
+                true,
+            ],
+            'with required params' => [
+                [
+                    'abc' => 1,
+                    'abcd' => 1,
+                ],
+                true,
+            ],
+            'with not required param' => [
+                [
+                    'fbclid' => 1,
+                ],
+                false,
+            ],
+            'with not required params' => [
+                [
+                    'fbclid' => 1,
+                    'gclid' => 1,
+                    'foo' => [
+                        'bar' => 1,
+                    ],
+                ],
+                false,
+            ],
+            'with combined params' => [
+                [
+                    'abc' => 1,
+                    'fbclid' => 1,
+                ],
+                true,
+            ],
+            'with multiple combined params' => [
+                [
+                    'abc' => 1,
+                    'fbclid' => 1,
+                    'abcd' => 1,
+                    'gclid' => 1
+                ],
+                true,
+            ]
+        ];
+    }
+
+    /**
+     * @test
+     *
+     * @dataProvider requireCacheHashValidateRelevantParametersDataProvider
+     * @param array $remainingArguments
+     * @param bool $expected
+     */
+    public function requireCacheHashValidateRelevantParameters(array $remainingArguments, bool $expected): void
+    {
+        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
+        $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError'] = true;
+        $GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] = ['gclid', 'fbclid', 'foo[bar]'];
+
+        $this->subject = $this->getAccessibleMock(TypoScriptFrontendController::class, ['dummy'], [], '', false);
+        $this->subject->_set('pageArguments', new PageArguments(1, '0', ['tx_test' => 1], ['tx_test' => 1], $remainingArguments));
+
+        if ($expected) {
+            static::expectException(ImmediateResponseException::class);
+        }
+        $this->subject->reqCHash();
+    }
+}
index 9c75c9d..80105ac 100644 (file)
@@ -4371,4 +4371,11 @@ return [
             'Deprecation-89554-DeprecateTYPO3CMSExtbaseMvcControllerAbstractController.rst',
         ],
     ],
+    'TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->reqCHash' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Deprecation-89868-RemoveReqCHashFunctionalityForPlugins.rst',
+        ],
+    ],
 ];
index fa57ffd..5161ec3 100644 (file)
@@ -636,4 +636,14 @@ return [
             'Deprecation-89722-GMENU_LAYERSRelatedPropertyTSFE-divSection.rst',
         ],
     ],
+    'TYPO3\CMS\Frontend\Plugin\AbstractPlugin->pi_USER_INT_obj' => [
+        'restFiles' => [
+            'Deprecation-89868-RemoveReqCHashFunctionalityForPlugins.rst',
+        ],
+    ],
+    'TYPO3\CMS\Frontend\Plugin\AbstractPlugin->pi_checkCHash' => [
+        'restFiles' => [
+            'Deprecation-89868-RemoveReqCHashFunctionalityForPlugins.rst',
+        ],
+    ],
 ];