Skip to content
Permalink
Browse files

fix(cache): clear running autoloadermap when flushing the caches

fixes #12255
  • Loading branch information...
jdalsem committed Apr 2, 2019
1 parent 776c474 commit 2ea53a3b9cf3e4e3010279be24d9a194339fb177
@@ -109,7 +109,7 @@ public function saveCache() {
if ($this->altered || $map->getAltered()) {
$spec[self::KEY_CLASSES] = $map->getMap();
$spec[self::KEY_SCANNED_DIRS] = $this->scannedDirs;
$this->cache->save(self::FILENAME, serialize($spec));
$this->cache->save(self::FILENAME, $spec);
}
}
return $this;
@@ -145,12 +145,7 @@ protected function getCacheFileContents() {
return false;
}
$serialization = $this->cache->load(self::FILENAME);
if (!$serialization) {
return false;
}
$spec = unserialize($serialization);
$spec = $this->cache->load(self::FILENAME);
if (isset($spec[self::KEY_CLASSES])) {
return $spec;
}
@@ -167,6 +162,11 @@ public function deleteCache() {
if ($this->cache) {
$this->cache->delete(self::FILENAME);
}
$this->loader->getClassMap()->setMap([])->setAltered(true);
$this->scannedDirs = [];
$this->altered = true;
return $this;
}
@@ -128,8 +128,7 @@ public function testPersistsCaches() {
$shutdown->persistCaches();
$cache = $app->_services->autoloadManager->getCache()->load(AutoloadManager::FILENAME);
$cache = unserialize($cache);
$this->assertContains($dir, $cache['scannedDirs']);
}

0 comments on commit 2ea53a3

Please sign in to comment.
You can’t perform that action at this time.