[TYPO3-mvc] Question regarding $GLOBALS['TSFE']->reqCHash() / cHash handling in extbase

Kai Tallafus kai.tallafus at gmx.at
Thu Nov 21 11:36:30 CET 2013


((sorry, it seems I had a formatting problem in my first e-mail))


Hi everybody,

in old pi_base plugins there was the following code in the pi_base base class:
 
if ($this->pi_checkCHash && count($this->piVars))    {
    $GLOBALS['TSFE']->reqCHash();
}
 
How is this handled in extbase? I found nothing like that inside the extbase code.
 
The reason I´m asking is that we have some websites running extbase plugins (mostly classic cachable list/detail action combinations), where sporadically a detail view is displayed instead of the list view (which is the default action). After clearing the TYPO3 cache, everything is fine. But after some time, the problem arises again.
 
After some debugging and searching the web, I found this blog post (sorry, it´s german):
http://juerghunziker.tumblr.com/post/63068466438/extbase-richtiges-caching-in-eigener-extension
 
The author recommends to put $GLOBALS['TSFE']->reqCHash(); into the detail action to prevent the above described behaviour.
 
Okay, now some questions:
1. I have no idea how this could even happen on a productive website, but obviously the problem is caused by calling the detail view with a missing cHash (we use realurl btw.). At least I´m able to reproduce it this way (and putting $GLOBALS['TSFE']->reqCHash() into the detail action actually seems to fix the problem). Has someone observed the same behaviour too?
 
2. In tslib_fe::makeCacheHash() respectively TypoScriptFrontendController::makeCacheHash() I found this:
 
// No cHash is set, check if that is correct
if ($this->cacheHash->doParametersRequireCacheHash(\TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $GET))) {
    $this->reqCHash();
}
 
The CacheHashCalculator:: doParametersRequireCacheHash() method checks for requireCacheHashPresenceParameters. But these are always empty and I found nothing inside TYPO3 core where CacheHashCalculator::setRequireCacheHashPresenceParameters() is called. So the above if statement is never true, and $this->reqCHash(); will never be called.
 
So how is the correct way to handle this inside extbase extensions? Is it like the blog author says or should we use CacheHashCalculator::setRequireCacheHashPresenceParameters() in our extensions or am I missing the point completely? :-)
 
We would be really really happy, if someone could shed a light on this, because this problem is bugging us for some time now.
 
Greets,
Kai


More information about the TYPO3-project-typo3v4mvc mailing list