Bug #28007

TCEmain::clear_cacheCmd relies on active BE_USER

Added by Jochen Weiland almost 10 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend API
Target version:
Start date:
2011-07-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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));
}


Related issues

Related to TYPO3 Core - Bug #32666: Fatal error during install processClosedOliver Hader2011-12-18

Actions
Related to TYPO3 Core - Bug #24406: error when using t3lib_TCEmain->clear_cacheCmd in frontendClosedSteffen Gebert2010-12-23

Actions
Related to TYPO3 Core - Bug #25287: error when using t3lib_TCEmain->clear_cacheCmd in CLI modeClosedSteffen Gebert2011-03-09

Actions
Related to TYPO3 Core - Bug #51829: TCEmain::log relies on active BE_USERRejected2013-09-07

Actions
#1

Updated by Jigal van Hemert almost 10 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.

#2

Updated by Oliver Hader almost 10 years ago

  • Target version changed from 4.5.4 to 4.5.6
#3

Updated by Chris topher over 9 years ago

  • Target version changed from 4.5.6 to 4.5.8
#4

Updated by Steffen Gebert over 9 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.

#5

Updated by Gerrit Code Review over 9 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

#6

Updated by Gerrit Code Review over 9 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

#7

Updated by Gerrit Code Review over 9 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

#8

Updated by Steffen Gebert over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#9

Updated by Ernesto Baschny over 9 years ago

  • Target version set to 4.5.11
#10

Updated by Riccardo De Contardi over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF