Ensure $commands being an array - fixes #26073
This commit is contained in:
parent
7836a8d8c7
commit
ef842ef20a
|
@ -197,6 +197,9 @@ class DependencyAnalyzer {
|
||||||
if (!is_array($commands)) {
|
if (!is_array($commands)) {
|
||||||
$commands = array($commands);
|
$commands = array($commands);
|
||||||
}
|
}
|
||||||
|
if (isset($commands['@value'])) {
|
||||||
|
$commands = [$commands];
|
||||||
|
}
|
||||||
$os = $this->platform->getOS();
|
$os = $this->platform->getOS();
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
if (isset($command['@attributes']['os']) && $command['@attributes']['os'] !== $os) {
|
if (isset($command['@attributes']['os']) && $command['@attributes']['os'] !== $os) {
|
||||||
|
|
|
@ -266,6 +266,7 @@ class DependencyAnalyzerTest extends TestCase {
|
||||||
[[], [['@attributes' => ['os' => 'Windows'], '@value' => 'grepp']]],
|
[[], [['@attributes' => ['os' => 'Windows'], '@value' => 'grepp']]],
|
||||||
// grep is known on all systems
|
// grep is known on all systems
|
||||||
[[], 'grep'],
|
[[], 'grep'],
|
||||||
|
[[], ['@attributes' => ['os' => 'Linux'], '@value' => 'grep']],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue