Invalid argument in LibraryDiscoveryParser->buildByExtension()

Created on 30 August 2016, over 8 years ago
Updated 20 September 2024, 7 months ago

I get following warning in recent log report whenever i do update.php on my drupal8.

I am in migration process.

Warning: Invalid argument supplied for foreach() in Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 133 of /opt/bitnami/apps/drupal/htdocs/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).

I look around all the related solutions alredy present but non apply to my case.
Hope I get some response.

🐛 Bug report
Status

Closed: cannot reproduce

Version

11.0 🔥

Component
Asset library 

Last updated 3 days ago

No maintainer
Created by

🇮🇳India RamyaT

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom catch

    This still needs more information. #14 is about a completely different error.

  • 🇺🇦Ukraine a.romantsov

    I've got same warning in LibraryDiscoveryParser->buildByExtension(). The reason was that one of custom module's *.libraries.yml file contained an irrcorrectly defined js assets attribute - without any items stated in it below, valid way would be to remove such attribute from *.libraries.yml at all, or define it as an empty array:

      js: {}
    

    so, the issue was caused because of next lines in *.libraries.yml file:

      js:
      dependencies:
        - core/ckeditor5

    which caused next situation for LibraryDiscoveryParser:

    and this enumeration in method buildByExtension() does not expect such a case:

    foreach ($library[$type] as $source => $options) {
    

    The simplest way to avoid such warnings would be to maintain a correct/recommended *.libraries.yml files structure within your custom modules. I don't see the point here in making any code adjustments/patches on the maintainer side, unless they wish to add a workaround for such cases. :)

  • Status changed to Closed: cannot reproduce 7 months ago
  • 🇦🇺Australia acbramley

    It's been over a year since this issue was set to PMNMI, it's very likely other issues were similar to #18

    I'm closing this for now, if anyone is still having this issue with valid libraries.yml files, please reopen with steps to reproduce.

    Thanks!

Production build 0.71.5 2024