Ensure $commands being an array - fixes #26073

This commit is contained in:
Thomas Müller 2016-10-19 23:17:39 +02:00 committed by Morris Jobke
parent 7836a8d8c7
commit ef842ef20a
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
2 changed files with 4 additions and 0 deletions

View File

@ -197,6 +197,9 @@ class DependencyAnalyzer {
if (!is_array($commands)) {
$commands = array($commands);
}
if (isset($commands['@value'])) {
$commands = [$commands];
}
$os = $this->platform->getOS();
foreach ($commands as $command) {
if (isset($command['@attributes']['os']) && $command['@attributes']['os'] !== $os) {

View File

@ -266,6 +266,7 @@ class DependencyAnalyzerTest extends TestCase {
[[], [['@attributes' => ['os' => 'Windows'], '@value' => 'grepp']]],
// grep is known on all systems
[[], 'grep'],
[[], ['@attributes' => ['os' => 'Linux'], '@value' => 'grep']],
];
}