Project

General

Profile

Actions

Bug #81293

closed

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

Added by David Bascom almost 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
-- undefined --
Assignee:
Category:
Extbase
Target version:
-
Start date:
2017-05-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

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, '', '&')
)

Files

Bildschirmfoto 2017-05-22 um 11.46.39.png (195 KB) Bildschirmfoto 2017-05-22 um 11.46.39.png David Bascom, 2017-05-22 12:01
exception.jpg (170 KB) exception.jpg Carsten Falkenberg, 2017-05-23 16:42

Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #78002: Require cHash for cached plugin actions in ExtbaseClosed2016-09-20

Actions
Related to TYPO3 Core - Task #81366: Make sure all http_build_query() calls use a defined separatorClosedMarkus Klein2017-05-29

Actions
Has duplicate TYPO3 Core - Bug #81565: ID parameter needs to be passed for the cHash calculation!Closed2017-06-13

Actions
Actions #1

Updated by Markus Klein almost 7 years ago

  • Related to Bug #78002: Require cHash for cached plugin actions in Extbase added
Actions #2

Updated by Markus Klein almost 7 years ago

  • Status changed from New to Accepted
  • Is Regression set to Yes

Wow. Good finding. Thanks.

The faulty commit was https://review.typo3.org/49976

I commented there.

Actions #3

Updated by Markus Klein almost 7 years ago

A question though:

Are you sure about the

&
thing? Because this is not URL-encoded, but HTML-encoded.
http_build_query is documented to return URL-encoded strings.

Actions #4

Updated by Markus Klein almost 7 years ago

  • Status changed from Accepted to Needs Feedback
  • Priority changed from Must have to -- undefined --
  • Target version deleted (Candidate for patchlevel)
  • Is Regression deleted (Yes)

@David: I double-checked the code now and it seems rather correct. Please explain where your & chars come from.

Actions #5

Updated by Carsten Falkenberg almost 7 years ago

I experienced the same issue, after submitting a form. removed all third-party extensions, except my distribution.

PHP 7.0.19
TYPO3 8.7.1

Actions #6

Updated by Helmut Hummel almost 7 years ago

Could it be that you both have arg-separator.output set to & in your php.ini?

Actions #7

Updated by Carsten Falkenberg almost 7 years ago

that is correct. arg_separator.output is set to & on that server.
changing the value to & solved the problem.

Actions #8

Updated by Gerrit Code Review almost 7 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52922

Actions #9

Updated by Gerrit Code Review almost 7 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52923

Actions #10

Updated by Markus Klein almost 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by Markus Klein almost 7 years ago

  • Related to Task #81366: Make sure all http_build_query() calls use a defined separator added
Actions #12

Updated by Markus Klein almost 7 years ago

  • Has duplicate Bug #81565: ID parameter needs to be passed for the cHash calculation! added
Actions #13

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF