Skip to content
Snippets Groups Projects
Commit c008616d authored by Benjamin Franzke's avatar Benjamin Franzke
Browse files

[TASK] Improve comments and readability in PageArgumentValidator

Make clear that the early-bail out for empty pageArguments is
done to prevent setting `disableCaches` to `true`.

Also makes that that the $pageNotFoundOnCacheHashError
condition is really tied to pageArguments being non-empty.
Prevents us from refactoring that code and missing this bit.

Resolves: #99860
Related: #99859
Releases: main, 11.5, 10.4
Change-Id: I98ffa3dffe76a37970784979a2c4f2a9a64aa5bf
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77752


Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarBenjamin Franzke <bfr@qbus.de>
parent adaa7dc0
Branches
Tags
No related merge requests found
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment