‪TYPO3CMS  ‪main
TYPO3\CMS\Frontend\Middleware\PageArgumentValidator Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\Middleware\PageArgumentValidator:

Public Member Functions

 __construct (private readonly CacheHashCalculator $cacheHashCalculator,)
 
 process (ServerRequestInterface $request, RequestHandlerInterface $handler)
 

Public Attributes

 $queryParams ['id'] = $pageArguments->getPageId()
 

Protected Member Functions

array< string, getRelevantParametersForCacheHashCalculation(PageArguments $pageArguments):array { $queryParams=$pageArguments-> getDynamicArguments ()
 
bool evaluateCacheHashParameter (CacheInstruction $cacheInstruction, string $cHash, array $relevantParameters, bool $pageNotFoundOnCacheHashError)
 
 evaluateQueryParametersWithoutCacheHash (CacheInstruction $cacheInstruction, array $dynamicArguments, bool $pageNotFoundOnCacheHashError)
 
 evaluatePageArgumentsWithoutCacheHash (CacheInstruction $cacheInstruction, PageArguments $pageArguments, bool $pageNotFoundOnCacheHashError)
 

Detailed Description

This middleware validates given request parameters against the common "cHash" functionality.

Definition at line 38 of file PageArgumentValidator.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::__construct ( private readonly CacheHashCalculator  $cacheHashCalculator)

Definition at line 42 of file PageArgumentValidator.php.

Member Function Documentation

◆ evaluateCacheHashParameter()

bool TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::evaluateCacheHashParameter ( CacheInstruction  $cacheInstruction,
string  $cHash,
array  $relevantParameters,
bool  $pageNotFoundOnCacheHashError 
)
protected

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.

Parameters
string$cHash‪the chash to check
array<string,string>‪$relevantParameters GET parameters necessary for cHash calculation
bool$pageNotFoundOnCacheHashError‪see $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError']
Returns
‪bool if false, then a PageNotFound response is triggered

Definition at line 128 of file PageArgumentValidator.php.

References TYPO3\CMS\Frontend\Cache\CacheInstruction\disableCache().

Referenced by TYPO3\CMS\Frontend\Middleware\PageArgumentValidator\process().

◆ evaluatePageArgumentsWithoutCacheHash()

TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::evaluatePageArgumentsWithoutCacheHash ( CacheInstruction  $cacheInstruction,
PageArguments  $pageArguments,
bool  $pageNotFoundOnCacheHashError 
)
protected

No cHash is set but there are query parameters, then calculate a possible cHash from the given query parameters and see if a cHash is returned (similar to comparing this).

Is only called if NO cHash parameter is given.

Definition at line 171 of file PageArgumentValidator.php.

References $GLOBALS, TYPO3\CMS\Frontend\Cache\CacheInstruction\disableCache(), and TYPO3\CMS\Frontend\Middleware\PageArgumentValidator\evaluateQueryParametersWithoutCacheHash().

Referenced by TYPO3\CMS\Frontend\Middleware\PageArgumentValidator\process().

◆ evaluateQueryParametersWithoutCacheHash()

TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::evaluateQueryParametersWithoutCacheHash ( CacheInstruction  $cacheInstruction,
array  $dynamicArguments,
bool  $pageNotFoundOnCacheHashError 
)
protected

No cHash is set but there are query parameters, check if that is correct

Should only be called if NO cHash parameter is given.

Parameters
array<string,string|array>‪$dynamicArguments

Definition at line 151 of file PageArgumentValidator.php.

References TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString(), and TYPO3\CMS\Frontend\Cache\CacheInstruction\disableCache().

Referenced by TYPO3\CMS\Frontend\Middleware\PageArgumentValidator\evaluatePageArgumentsWithoutCacheHash().

◆ getDynamicArguments()

array<string, getRelevantParametersForCacheHashCalculation(PageArguments $pageArguments): array { $queryParams = $pageArguments-> TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::getDynamicArguments ( )
protected

Filters out the arguments that are necessary for calculating cHash

Returns
‪array<string, string>

◆ process()

Member Data Documentation

◆ $queryParams

TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::$queryParams[ 'id'] = $pageArguments->getPageId()