Bug #88227

f:form with noCache=1 causes cHash Errors

Added by Timo Pfeffer 8 months ago. Updated 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2019-04-26
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.2
Tags:
FormViewHelper,Fluid,Requests
Complexity:
Is Regression:
Sprint Focus:

Description

When you have a form like <f:form pageUid="1" action="myAction" controller="myController" noCache="1">...</form>
then the core will not generate a cHash. If the form is being sent, then the FrontendRequestHandler will throw a 404 when the $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError'] is defined. In my opinion is a real problem, because sometimes you have a searchform which should show the matching results. The results itself can change everytime. So you have to clear the frontend cache to show the most recent results. Because of other not so much relevant informations on the page it does not make sense to set the page itself to uncached. So you have to set the searchform itself to sendout a no_cache=1 flag. But as I descriped above causes a 404 error. Another alternative would be to set the complete plugin (searchform with the results itself) to ignore the cHash. This is working, but you dont want to open this door, because of security. So another solution is needed here. I think if the form is generating a chash as long no "noCHash=1" set, then you donÄt have that problem.

History

#1 Updated by Timo Pfeffer 8 months ago

The "noCacheHash=1" attribute causes the same error

#2 Updated by Timo Pfeffer 8 months ago

  • PHP Version changed from 7.0 to 7.2

#3 Updated by Christoph Lehmann 7 months ago

Setting noCache=1 is really bad in general and may not make sense as a viewhelper argument anymore since extbase parameters require a cHash since 8.7 or so.

Adding your target action in non-cachable actions should solve your problem.

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Vendor.extension_name',
    'Storemap',
    array(
        'StoreList' => 'list',
    ),
    // non-cacheable actions
    array(
        'StoreList' => 'list',
    )
);

Setting noCacheHash="1" may only be used when you have method="get" with dynamic parameters (like of a search form)

Also available in: Atom PDF