Problem/Motivation

Notice: Undefined property: stdClass::$valid in Drupal\filecache\Cache\FileSystemBackend->garbageCollection() (line 247 of /www/wwwroot/spare-wheel.com/modules/filecache/src/Cache/FileSystemBackend.php)

#0 /www/wwwroot/spare-wheel.com/core/includes/bootstrap.inc(600): _drupal_error_handler_real()
#1 /www/wwwroot/spare-wheel.com/modules/filecache/src/Cache/FileSystemBackend.php(247): _drupal_error_handler()
#2 /www/wwwroot/spare-wheel.com/core/modules/system/system.module(1215): Drupal\filecache\Cache\FileSystemBackend->garbageCollection()
#3 [internal function]: system_cron()
#4 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array()
#5 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/Cron.php(236): Drupal\Core\Extension\ModuleHandler->invoke()
#6 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/Cron.php(134): Drupal\Core\Cron->invokeCronHandlers()
#7 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#8 /www/wwwroot/spare-wheel.com/core/modules/system/src/CronController.php(46): Drupal\Core\ProxyClass\Cron->run()
#9 [internal function]: Drupal\system\CronController->run()
#10 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#11 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#13 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#14 /www/wwwroot/spare-wheel.com/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#15 /www/wwwroot/spare-wheel.com/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#16 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#17 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#18 /www/wwwroot/spare-wheel.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#19 /www/wwwroot/spare-wheel.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
#20 /www/wwwroot/spare-wheel.com/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
#21 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#22 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#23 /www/wwwroot/spare-wheel.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#24 /www/wwwroot/spare-wheel.com/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#25 /www/wwwroot/spare-wheel.com/index.php(19): Drupal\Core\DrupalKernel->handle()
#26 {main}

Steps to reproduce

I get this Notice when I run cron.
File Cache 8.x-1.0-alpha3 + Drupal Version 8.9.2

Issue fork filecache-3163561

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

idflorin created an issue. See original summary.

idflorin’s picture

Fixed somehow:
I changed in "modules/filecache/src/Cache/FileSystemBackend.php"

			if (!$item->valid) {
			  $this->delete($item->cid);
			}

with

		  if(isset($item->valid)){
			if (!$item->valid) {
			  $this->delete($item->cid);
			}
		  }

pfrenssen made their first commit to this issue’s fork.

pfrenssen’s picture

Issue tags: +DevDaysAthens2026
pfrenssen’s picture

Thanks for the report and the patch! While adding test coverage it turns out there are other possible failure modes in the garbage collection, which I have also addressed in the MR.

  • pfrenssen committed 146b431a on 8.x-1.x
    fix: #3163561 Notice: Undefined property: stdClass::$valid in...
pfrenssen’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.