Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76e9e81

Browse files
anemirovskyweitzman
authored andcommitted
Fix bug where pm:security misses required security updates. (#3766)
The bug here is that 'packages-dev' and 'packages' are both arrays with numeric keys. Using the '+' operator on them, according to PHP's documentation (https://secure.php.net/manual/en/language.operators.array.php) means that if a key exists in both, whatever array is on the right-hand side will have that key's value ignored and the left-hand side's value will be used. To ensure that the 'packages' array is appended to the 'packages-dev' array, we have to use array_merge, which always appends numeric keys (https://secure.php.net/manual/en/function.array-merge.php).
1 parent 967c157 commit 76e9e81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Commands/pm/SecurityUpdateCommands.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function loadSiteComposerLock()
136136
*/
137137
protected function registerAllSecurityUpdates($composer_lock_data, $security_advisories_composer_json)
138138
{
139-
$both = $composer_lock_data['packages-dev'] + $composer_lock_data['packages'];
139+
$both = array_merge($composer_lock_data['packages-dev'], $composer_lock_data['packages']);
140140
foreach ($both as $package) {
141141
$name = $package['name'];
142142
$this->registerPackageSecurityUpdates($security_advisories_composer_json, $name, $package);

0 commit comments

Comments
 (0)