Issue Bug Closed

#81293cacheHash fails to be generated because of missing id although id is present in request-string

David Bascom 05/22/17, 12:02 updated 10/02/18, 10:59

Description

An error #1467983513: ID parameter needs to be passed for the cHash calculation! is thrown in certain cases although id is present in GET-query (see screenshot for example).

Reason: In sysext/extbase/Classes/Mvc/Web/CacheHashEnforcer.php->enforceForRequest() on line 66 this function is called:

$this->cacheHashCalculator->getRelevantParameters(
    http_build_query($parameters)
)

http_build_query() builds the query using the urlencoded & instead of a simple “&”. The query-string is then passed to sysext/frontend/Classes/Page/CacheHashCalculator.php->splitQueryStringToArray() which uses an simple & to explode the parameters again: explode(‘&’, …) and convert them back to an associative array:

     $parameters = array_filter(explode('&', ltrim($queryString, '?')));

This leads to an error, because the id-parameter can not be extracted correctly in some cases.
To solve the problem, the line in sysext/extbase/Classes/Mvc/Web/CacheHashEnforcer.php->enforceForRequest() needs to be corrected to:

$this->cacheHashCalculator->getRelevantParameters(
    http_build_query($parameters, '', '&')
)

Reviews 2