Project

General

Profile

Actions

Bug #88227

closed

f:form with noCache=1 causes cHash Errors

Added by Timo Pfeffer almost 5 years ago. Updated over 4 years ago.

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

0%

Estimated time:
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.

Actions #1

Updated by Timo Pfeffer almost 5 years ago

The "noCacheHash=1" attribute causes the same error

Actions #2

Updated by Timo Pfeffer almost 5 years ago

  • PHP Version changed from 7.0 to 7.2
Actions #3

Updated by Christoph Lehmann almost 5 years 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)

Actions #4

Updated by Benni Mack over 4 years ago

  • Status changed from New to Closed

Christoph's recommendation is correct. In addition, TYPO3 v9's cHash implementation should show you that you don't need to deal with cHash anymore anyways. so I will close this issue for now. AFAICS this only affects TYPO3 v8. If you feel that this is not fixed yet, let me know and I will re-open the ticket.

Actions

Also available in: Atom PDF