Bug #28007
closedTCEmain::clear_cacheCmd relies on active BE_USER
100%
Description
Sympton:
An extension (like ve_guestbook) might clear the cache with this command:
$GLOBALS ['TSFE']->clearPageCacheContent_pidList ( $GLOBALS ['TSFE']->id );
Since clearing of the cache is now written to the system log, the following call in function clear_cacheCmd() class.t3lib_tcemain.php will fail if no BE_USER is logged in:
$this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd));
Solution: check whether a BE_USER object exists before making the call to the log (otherwise the log message would have no user name either)
if ($this->BE_USER) {
$this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd));
}
Updated by Jigal van Hemert over 13 years ago
- Status changed from New to Needs Feedback
tslib_fe::clearPageCacheContent_pidList() (in 4.5) uses either the caching framework to clear the cache, or performs a query on the cache_pages table.
The function t3lib_TCEmain::clear_cacheCmd() needs a BE user. This function is not meant to be used in FE context. If you absolutely want to use this function than it's also quite easy to create a BE user.
Updated by Oliver Hader over 13 years ago
- Target version changed from 4.5.4 to 4.5.6
Updated by Chris topher about 13 years ago
- Target version changed from 4.5.6 to 4.5.8
Updated by Steffen Gebert almost 13 years ago
- Subject changed from Error when cache cleared by extension to TCEmain::clear_cacheCmd relies on active BE_USER
- Status changed from Needs Feedback to Accepted
- Target version deleted (
4.5.8)
As this error also occurs in CLI context, I want to finally fix this. I was against forcing TCEmain to be used in BE only by adding this call all the time. People abuse TYPO3 in all kind of ways, thus also TCEmain in other contexts.
Updated by Gerrit Code Review almost 13 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7633
Updated by Gerrit Code Review almost 13 years ago
Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/7806
Updated by Gerrit Code Review almost 13 years ago
Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/7807
Updated by Steffen Gebert almost 13 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 7b2dc40f28b9790cfa9c0788090e274616c9476f.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed