8000 [FrameworkBundle] fix ValidatorCacheWarmer: use serializing ArrayAdapter · symfony/symfony@9b84d72 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b84d72

Browse files
committed
[FrameworkBundle] fix ValidatorCacheWarmer: use serializing ArrayAdapter
1 parent 95c03f2 commit 9b84d72

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function warmUp($cacheDir)
6262
}
6363

6464
$adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
65-
$arrayPool = new ArrayAdapter(0, false);
65+
$arrayPool = new ArrayAdapter(0);
6666

6767
$loaders = $this->validatorBuilder->getLoaders();
6868
$metadataFactory = new LazyLoadingMetadataFactory(new LoaderChain($loaders), new Psr6Cache($arrayPool));
@@ -86,7 +86,10 @@ public function warmUp($cacheDir)
8686
spl_autoload_unregister(array($adapter, 'throwOnRequiredClass'));
8787
}
8888

89-
$values = $arrayPool->getValues();
89+
// the ArrayAdapter stores the values serialized as the MetaData objects
90+
// are mutated inside LazyLoadingMetadataFactory after being written into the cache
91+
// so here we un-serialize the values first
92+
$values = array_map(function ($val) { return unserialize($val); }, $arrayPool->getValues());
9093
$adapter->warmUp(array_filter($values));
9194

9295
foreach ($values as $k => $v) {

0 commit comments

Comments
 (0)
0