The current code assumes that elements are always arrays:
|
|
|
if (is_array($json)) { |
|
if (isset($json['extra']['installer-paths']) && is_array($json['extra']['installer-paths'])) { |
|
foreach ($json['extra']['installer-paths'] as $install_path => $items) { |
|
if (in_array('type:drupal-core', $items) || |
|
in_array('drupal/core', $items) || |
|
in_array('drupal/drupal', $items)) { |
However, upstream "allows" simple strings by casting to array:
https://github.com/composer/installers/blob/2a9170263fcd9cc4fd0b50917293c21d6c1a5bfe/src/Composer/Installers/BaseInstaller.php#L116-L119
Predictably, this causes a crash:
PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in /webflo/drupal-finder/src/DrupalFinder.php:113
Stack trace:
#0 webflo/drupal-finder/src/DrupalFinder.php(113): in_array('type:drupal-cor...', 'a-module-name-im-using...')
Whether to follow upstream or not, it would be best to avoid the crash since strings instead of arrays is "not wrong" (?).
The current code assumes that elements are always arrays:
drupal-finder/src/DrupalFinder.php
Lines 205 to 211 in 9f16035
However, upstream "allows" simple strings by casting to array:
https://github.com/composer/installers/blob/2a9170263fcd9cc4fd0b50917293c21d6c1a5bfe/src/Composer/Installers/BaseInstaller.php#L116-L119
Predictably, this causes a crash: