Skip to content

Commit 80503cb

Browse files
committed
Run security advisory filter first to avoid inconsistent states due to the optimizer not being aware of further removals coming after
Fixes #12603
1 parent 5ad6a46 commit 80503cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Composer/DependencyResolver/PoolBuilder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ public function buildPool(array $repositories, Request $request): Pool
350350

351351
$this->io->debug('Built pool.');
352352

353-
$pool = $this->runOptimizer($request, $pool);
353+
// filter vulnerable packages before optimizing the pool otherwise we may end up with inconsistent state where the optimizer took away versions
354+
// that were not vulnerable and now suddenly the vulnerable ones are removed and we are missing some versions to make it solvable
354355
$pool = $this->runSecurityAdvisoryFilter($pool, $repositories);
356+
$pool = $this->runOptimizer($request, $pool);
355357

356358
Intervals::clear();
357359

0 commit comments

Comments
 (0)