-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Support advisories from multiple repositories for the same package #11436
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,14 +263,12 @@ private function getSecurityAdvisoriesForConstraints(array $packageConstraintMap | |
continue; | ||
} | ||
|
||
$result = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories); | ||
foreach ($result['namesFound'] as $nameFound) { | ||
unset($packageConstraintMap[$nameFound]); | ||
} | ||
|
||
$advisories = array_merge($advisories, $result['advisories']); | ||
$advisories[] = $repository->getSecurityAdvisories($packageConstraintMap, $allowPartialAdvisories)['advisories']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable should probably be renamed to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✔️ |
||
} | ||
|
||
$advisories = array_merge_recursive(...$advisories); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bad idea to me, as advisories themselves are also arrays so a recursive merge could end up doing weird things. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
what do you mean with that ? AFAICT, you need to merge only the first level of the list (to do the equivalent of what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
ksort($advisories); | ||
|
||
return $advisories; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting rid of array_merge() in a loop is also a performance improvement.