diff --git a/typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php b/typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php index 6625bbb69ea6032952881652c68ce43ee2157121..3ce21fffc8c24f006a39a575f7281ed0c0432357 100644 --- a/typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php +++ b/typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php @@ -207,16 +207,17 @@ class PageArgumentValidator implements MiddlewareInterface, LoggerAwareInterface return $this->evaluateQueryParametersWithoutCacheHash($pageArguments->getDynamicArguments(), $pageNotFoundOnCacheHashError); } $relevantParameters = $this->getRelevantParametersForCacheHashCalculation($pageArguments); + // There are parameters that would be needed for the current page, but no cHash is given. + // Thus, a "page not found" error is thrown - as configured via "pageNotFoundOnCHashError". + if (!empty($relevantParameters) && $pageNotFoundOnCacheHashError) { + return false; + } // There are no parameters that require a cHash. // We end up here when the site was called with an `id` param, e.g. https://example.org/index?id=123. + // Avoid disabling caches in this case. if (empty($relevantParameters)) { return true; } - // There are parameters that would be needed for the current page, but no cHash is given. - // Thus, a "page not found" error is thrown - as configured via "pageNotFoundOnCHashError". - if ($pageNotFoundOnCacheHashError) { - return false; - } // Caching is disabled now (but no 404) $this->disableCache = true; $this->timeTracker->setTSlogMessage('No &cHash parameter was sent for given query parameters, so caching is disabled', LogLevel::ERROR);