- Issue created by @enchufe
- last update
over 1 year ago 30,341 pass - Issue was unassigned.
- Status changed to Needs review
over 1 year ago 10:18pm 26 July 2023 - Status changed to Needs work
over 1 year ago 2:14pm 27 July 2023 - πΊπΈUnited States smustgrave
Will need to land in the 11.x branch first.
Could it be a larger bug that that variable is not an array?
As a bug will need a test
- First commit to issue fork.
- π¬π§United Kingdom longwave UK
Can you share the relevant custom code that causes this? It will help us write a test case. I've seen the same library attached multiple times before (I'm sure core does it in places) so it will be interesting to see how to trigger this.
- Status changed to Postponed: needs info
over 1 year ago 5:55pm 30 July 2023 - π¬π§United Kingdom nlisgo
Without clear steps to recreate we only have the fix to guide what a test might look like.
I tried to recreate the issue by injecting the same library twice on the same page but it didn't trigger the TypeError:
function olivero_preprocess_html(&$variables) { $variables['#attached']['library'][] = 'olivero/nlisgo'; ... } function olivero_preprocess_block(&$variables) { if (!empty($variables['elements']['#id'])) { if ($variables['elements']['#id'] === 'olivero_page_title') { $variables['#attached']['library'][] = 'olivero/nlisgo'; } ... } ... }
- πΊπΈUnited States frob US
The only way I was able to recreate this error is when I had a faulty call to
hook_library_info_alter
that added an array as a dependency.