I'm running multiple websites and they all produce this error when I clear all cache (this is a Windows server):

PHP Fatal error: Uncaught Error: Call to a member function scanDirectory() on null in C:\******\web\core\lib\Drupal\Core\Asset\CssCollectionOptimizer.php:200
Stack trace:
#0 C:\******\web\modules\contrib\wincachedrupal\src\Asset\CssCollectionOptimizer.php(53): Drupal\Core\Asset\CssCollectionOptimizer->deleteAll()
#1 C:\******\web\core\includes\common.inc(1039): Drupal\wincachedrupal\Asset\CssCollectionOptimizer->deleteAll()
#2 C:\******\web\core\includes\utility.inc(55): drupal_flush_all_caches()
#3 C:\******\vendor\drush\drush\src\Commands\core\CacheCommands.php(204): drupal_rebuild(Object(Composer\Autoload\ClassLoader), Object(Symfony\Component\HttpFoundation\Request))
#4 [internal function]: Drush\Commands\core\CacheCommands->rebuild(Array)
#5 C:\******\vendor\consolidation\annotated-command\src\CommandProcessor.php(257): call_user_func_array(Array, Array)
#6 C:\******\vendor\consolidation\annotated-command\src\C in C:\******\web\core\lib\Drupal\Core\Asset\CssCollectionOptimizer.php on line 200

If anyone could point me in the right direction, that's be great.

My specs:
Drupal 8.8.2
Windows 10
PHP 7.2.25
composer 1.9.3
drush 9

Comments

Olivier_FSU created an issue. See original summary.

Dudelinos’s picture

Title: Serror when calling scanDirectory() on null » Error when calling scanDirectory() on null
longwave’s picture

Looks like this might be triggered by the "wincachedrupal" module, https://www.drupal.org/project/wincachedrupal ?

avpaderno’s picture

Version: 8.8.2 » 8.8.x-dev
Dudelinos’s picture

Are you implying updating to the dev version will solves this? I'm not sure I'm comfortable to do that on a production environment.

avpaderno’s picture

The bug will be fixed in 8.8.x (the Git branch) and later a new release will created. In bug reports, as well as in feature requests and tasks, the issue version is a development snapshot version such as 8.8.x-dev.

Dudelinos’s picture

Version: 8.8.x-dev » 8.8.2
Dudelinos’s picture

Version: 8.8.2 » 8.8.x-dev
Dudelinos’s picture

Ok Thanks, I'll wait for the stable release then. The error doesn't stop me from clearing the cache, even if it's annoying.

Dudelinos’s picture

Ok, I have updated core to 8.8.3 and the issue is still there. At this point, I'm contemplating rebuilding the entire website out of frustration.

rajeevgole’s picture

Project: Drupal core » WinCache Drupal
Version: 8.8.x-dev » 8.x-1.x-dev
Component: base system » Code

I am also facing the same issues.

Drupal 8.8.5
Drupal 7.3

bluegeek9’s picture

What are the steps to reproduce this bug? Just clear the cache?

It sounds very similair to #2854825: Deprecated function: drupal_realpath. CssCollectionOptimizer and JsCollectionOptimizer were not implementing inheritance correctly, they did not implement a FileSystemInterface. The latest dev release contains the fix.