- Issue created by @thefancywizard
The formatSearchTerms() method in IconManagerService assumes that the search_terms property exists and is always an array. However, if an icon is missing search_terms (or it is NULL), the method will trigger a fatal TypeError:
TypeError: array_push(): Argument #1 ($array) must be of type array, null given in array_push()
$term_list = \Drupal::service('fontawesome_iconpicker_widget.icon_manager')->getFormattedTermList();
. TypeError: array_push(): Argument #1 ($array) must be of type array, null given
Update formatSearchTerms() to defensively check that $properties['search_terms'] is an array before trying to array_push() into it. If search_terms is missing or NULL, initialize it as an empty array before pushing. This makes the method resilient against incomplete or custom icon metadata.
Needs review
3.0
Code