I'm seeing this error in my logs:

TypeError: Argument 1 passed to Drupal\filecache\Cache\FileSystemBackend::prepareItem() must be an instance of stdClass, bool given, called in /home/pieter/v/joinup-dev/web/modules/contrib/filecache/src/Cache/FileSystemBackend.php on line 245 in /home/pieter/v/joinup-dev/web/modules/contrib/filecache/src/Cache/FileSystemBackend.php on line 361 [ae3d22e0-6f94-46de-b587-25500d6c89c7] #0 /home/pieter/v/joinup-dev/web/modules/contrib/filecache/src/Cache/FileSystemBackend.php(245): Drupal\filecache\Cache\FileSystemBackend->prepareItem(false, true)

It turns out to be caused by a README.md file being present in my filecache folder that explains the reason for these cache files to be present in the repository.

The bug is in FileSystemBackend::get(), in this snippet:

    if ($item = $this->getFile($filename)) {
      $item = $this->prepareItem($item, $allow_invalid);
      // ...
    }

The call to $this->getFile() might return FALSE if the file cannot be deserialized, or NULL if the file does not exist. We should check the value passing it to the $this->prepareItem() call.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pfrenssen created an issue. See original summary.

pfrenssen’s picture

Status: Active » Needs review
FileSize
1 KB

  • pfrenssen committed b3bae69 on 8.x-1.x
    Issue #3082271 by pfrenssen: TypeError: Argument 1 passed to ::...
pfrenssen’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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