Fixed Error about CacheFactory.php in logs

Affected version
v2.2.3 Patch 1


Well-known member

I am seeing this same error in the logs from time to time. (php 8.0.2)

TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given src/XF/CacheFactory.php:143
Created by: Unknown Account 12 Şubat 2021 22:55
Stack Trace
#0 src/XF/CacheFactory.php(143): fclose(false)
#1 src/XF/CacheFactory.php(108): XF\CacheFactory->filesystemCacheCleaner('/home/xk/...', '.cache')
#2 src/XF/CacheFactory.php(79): XF\CacheFactory->createFilesystemCache(Array)
#3 src/XF/CacheFactory.php(34): XF\CacheFactory->instantiate('Filesystem', Array)
#4 src/XF/App.php(687): XF\CacheFactory->create('Filesystem', Array)
#5 src/XF/Container.php(228): XF\App->XF\{closure}('page', Array, Object(XF\Container))
#6 src/XF/App.php(2488): XF\Container->create('cache', 'page')
#7 src/XF/Pub/App.php(56): XF\App->cache('page', false)
#8 src/XF/Container.php(28): XF\Pub\App->XF\Pub\{closure}(Object(XF\Container))
#9 src/XF/Pub/App.php(692): XF\Container->offsetGet('pageCache')
#10 src/XF/Pub/App.php(104): XF\Pub\App->pageCache()
#11 src/XF/App.php(2322): XF\Pub\App->start(true)
#12 src/XF.php(488): XF\App->run()
#13 index.php(20): XF::runApp('XF\\Pub\\App')
#14 {main}
Request state
array(4) {
  ["url"] => string(17) "/konu/952/sayfa-3"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  ["_POST"] => array(0) {

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.4).

Change log:
Prevent an error from being sporadically triggered when cleaning up the filesystem cache.
There may be a delay before changes are rolled out to the XenForo Community.