10000 [FrameworkBundle] fix ValidatorCacheWarmer: use serializing ArrayAdapter by dmaicher · Pull Request #23558 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] fix ValidatorCacheWarmer: use serializing ArrayAdapter #23558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[FrameworkBundle] fix ValidatorCacheWarmer: use serializing ArrayAdapter
  • Loading branch information
dmaicher committed Jul 17, 2017
commit 9b84d72697f76a590be17ada0d1c103ac4d4908a
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function warmUp($cacheDir)
}

$adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
$arrayPool = new ArrayAdapter(0, false);
$arrayPool = new ArrayAdapter(0);
Copy link
Member
@nicolas-grekas nicolas-grekas Jul 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 is the default so it can be removed also


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

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

foreach ($values as $k => $v) {
Expand Down
0