Issue Bug Closed

#28007TCEmain::clear_cacheCmd relies on active BE_USER

Jochen Weiland 07/08/11, 23:26 updated 10/24/17, 20:18

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

Reviews 0

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