Issue Bug Closed

#69349needs cHash for links where UriBuilder does not add one --- please close

Jonas Eberle 08/27/15, 12:00 updated 10/05/18, 11:41

Description

After upgrade from Typo3 v7.2 -> v7.4 we encountered this problem:

Links to non-cacheable actions created by UriBuilder do (sometimes!) not contain cHashes (which is correct imho) but upon trying to call the link Typo3 rejects because there is no cHash.

We had this in very different circumstances that lead to different results. I will showcase 1 of these cases.

LocalConfiguration.php:

...
    'FE' => array(
        'cHashExcludedParameters' => 'L',
        'cHashOnlyForParameters' => '',
        'pageNotFoundOnCHashError' => '1',    // this is required for typoscript_rendering which we use. I made the bug-testing all without this extension to be sure that it does not interfere, though. We want this option to stay enabled.
        'pageNotFound_handling' => '1',
...
    ),

The generated link:

{f:uri.action(
    pageUid: settings.links.results.pid,
    pluginName: 'MyAccount',
    controller: 'SearchObject',
    action: 'saveForCurrentUser',
    format: 'json'
)}

TEST 1

ext_localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Dm.' . $_EXTKEY,
    'MyAccount',
    array(
        'SearchObject' => 'listForCurrentUser, delete, saveForCurrentUser',
    ),
    array(
        'SearchObject' => 'listForCurrentUser, delete, saveForCurrentUser',
    )
);

+TEST 1: expectation+
The link does not contain a cHash
The linked page is rendered

+TEST 1: result+
The link contains a cHash
The linked page is rendered

TEST 2

ext_localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Dm.' . $_EXTKEY,
    'MyAccount',
    array(
        'SearchObject' => 'listForCurrentUser, delete, saveForCurrentUser',
    ),
    array(
        'SearchObject' => 'listForCurrentUser, delete, saveForCurrentUser',
    )
);

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Dm.' . $_EXTKEY,
    'Result',
    array(
        'Results' => 'skeletonContainer, results, count',
        'SearchObject' => 'listForCurrentUser, delete, saveForCurrentUser',
    ),
    array(
        'Results' => 'results, count',
        'SearchObject' => 'listForCurrentUser, delete, saveForCurrentUser',
    )
);

(just the same, except that the controller-action is also available to another plugin). The link is generated exactly the same way, though

+TEST 2: expectation+
The link does not contain a cHash
The linked page is rendered

+TEST 2: result+
The link does not contain a cHash
The linked page shows the error ‘cHash empty’

So in this case it was dependant on how many plugins had the same (non-cacheable) action configured. But we have seen this on a controller action that was only defined once as well.

I am puzzled.

I guess we see 2 problems here: UriBuilder does not behave consistently and the Routing expects cHashes where there do not need to be any (imho).

Stupid workaround:

Let \TYPO3\CMS\Frontend\Page\CacheHashCalculator::doParametersRequireCacheHash() always return FALSE.
Then links still get generated as before but the verification is off.

Suggestions:

The same logic (should cHash be present?) should be used in both cases: on generation and on verification.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.