From 7b2dc40f28b9790cfa9c0788090e274616c9476f Mon Sep 17 00:00:00 2001 From: Steffen Gebert Date: Thu, 29 Dec 2011 12:21:32 +0100 Subject: [PATCH] [BUGFIX] TCEmain::clear_cacheCmd relies on active BE_USER Several developers abuse t3lib_TCEmain and instantiate it also in other contexts than BE, for which it never was made. As this breaks several extensions that use it in FE or CLI mode and the fix is trivial, avoid crashing. Change-Id: I0998b4fc36bb803f82becbbca0137a7dfd43eb8a Fixes: #28007 Releases: 4.7, 4.6, 4.5 Reviewed-on: http://review.typo3.org/7633 Reviewed-by: Philipp Gampe Tested-by: Philipp Gampe Reviewed-by: Wouter Wolters Reviewed-by: Georg Ringer Tested-by: Georg Ringer Reviewed-by: Tolleiv Nietsch Tested-by: Tolleiv Nietsch --- t3lib/class.t3lib_tcemain.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t3lib/class.t3lib_tcemain.php b/t3lib/class.t3lib_tcemain.php index 3a9bdd111a83..d2f75980b3c9 100644 --- a/t3lib/class.t3lib_tcemain.php +++ b/t3lib/class.t3lib_tcemain.php @@ -6646,7 +6646,9 @@ class t3lib_TCEmain { * @return void */ public function clear_cacheCmd($cacheCmd) { - $this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd)); + if (is_object($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)); + } // Clear cache for either ALL pages or ALL tables! switch ($cacheCmd) { -- 2.20.1