Bug #21345
closedcHash is generated when no parameters are given
0%
Description
If somebody adds accidentally useCacheHash to typolink configuration the caching of Typo3 gets broken (only in combination with RealURL).
Example Typoscript :
10 = TEXT
10 {
typolink {
parameter.data = TSFE:id
additionalParams.dataWrap = &{getIndpEnv : QUERY_STRING}
useCacheHash = 1
}
}
If getIndpEnv : QUERY_STRING is empty the value of additionalParams is '&'
The typolink method of tslib_content calculates always the cHash if useCacheHash is set in typolinkconfig.
If additionalParams is '&' t3lib_div::cHashParams returns an array with two items:
'encryptionKey' => 'encrypt key
'' => empty
so the cHash gets calculated faulty and RealURL takes the faulty cHash and stores it to the tx_realurl_chashcache table.
The result is faulty cHash calculations:
The incoming cHash "f2810e4376" and calculated cHash "5de407b1c4" did not match, so caching was disabled. The fieldlist used was "encryptionKey"
and the site runs on non cached.
The attached patch pervents faulty calculations.
(issue imported from #M12322)
Files
Updated by Steffen Müller about 15 years ago
cHash calculation is fine, but your Typoscript example has the bug. You should check in TS if QUERY_STRING is empty.
Updated by Michael Birchler about 15 years ago
Yes sure it's a bug in the example Typoscript the correct way would be to write it this way:
additionalParams = &{getIndpEnv : QUERY_STRING}
additionalParams {
insertData = 1
if.isTrue.data = getIndpEnv : QUERY_STRING
}
The patch just prevents the possible error in Typoscript.
Updated by Michael Birchler about 15 years ago
bug_12322.diff is the correct patch
Updated by Steffen Müller about 15 years ago
One cannot prevent all possible misconfigurations in typoscript. So your patch just blows up the core without gaining much effect.
Since we agree it is a misconfiguration in Typoscript, I plead for closing this bug.
Updated by Michael Birchler about 15 years ago
I think such typoscript errors exists on many sites. If you have such an error on a big site is hard to locate it. The only hint is "the incoming cHash "xxxx" and calculated cHash "xxx" did not match" in the admin panel.
For me it's not a blow up but rather a small improvement that prevents possible caching problems with RealURL.
Updated by Michael Birchler about 15 years ago
An other problem occurs if you have the following typoscript setup:
10 = TEXT
10 {
typolink {
parameter.data = TSFE:id
additionalParams.dataWrap = &tx_testext_pi1[showUid]={field:uid}
}
}
If uid is empty t3lib_div::cHashParams returns a array with an empty value. And the cHash does not match again.
Updated by Steffen Müller about 15 years ago
Nobody prevents you from sending an RFC to the core list and try to get it into the core:
http://typo3.org/teams/core/core-mailinglist-rules/
Updated by Dmitry Dulepov over 14 years ago
I confirm the problem. I just found identical cHashes coming from the empty parameter string. They spoil RealURL cache.