Skip to content
Snippets Groups Projects
Commit c3b90852 authored by John Albin Wilkins's avatar John Albin Wilkins
Browse files

Prevent invalid components data from throwing PHP error

parent 8230b073
No related branches found
Tags 8.x-2.1
No related merge requests found
......@@ -124,14 +124,16 @@ class ComponentsInfo {
foreach ($extension_list->getAllInstalledInfo() as $name => $extension_info) {
// Find the components info.
$info = !empty($extension_info['components']) ? $extension_info['components'] : [];
$info = isset($extension_info['components']) && is_array($extension_info['components']) ? $extension_info['components'] : [];
// Look for namespaces using 1.x API (backwards compatibility).
if (!isset($info['namespaces']) && isset($extension_info['component-libraries'])) {
$this->logWarning(sprintf('Components 8.x-1.x API is deprecated in components:8.x-2.0 and is removed from components:3.0.0. Update the %s.info.yml file to replace the component-libraries.[namespace].paths data with components.namespaces.[namespace]. See https://www.drupal.org/node/3082817', $name));
foreach ($extension_info['component-libraries'] as $namespace => $namespace_data) {
if (!empty($namespace_data['paths'])) {
$info['namespaces'][$namespace] = $namespace_data['paths'];
if (is_array($extension_info['component-libraries'])) {
foreach ($extension_info['component-libraries'] as $namespace => $namespace_data) {
if (!empty($namespace_data['paths'])) {
$info['namespaces'][$namespace] = $namespace_data['paths'];
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment