Skip to content

"Invalid argument supplied for foreach" #11

Description

@rbos

I was debugging an error today with Islandora, and every initial page load was getting an error.

Warning: Invalid argument supplied for foreach() in Drupal\islandora_breadcrumbs\IslandoraBreadcrumbBuilder->nodeHasReferenceFields() (line 236 of modules/contrib/islandora/modules/islandora_breadcrumbs/src/IslandoraBreadcrumbBuilder.php).

With some digging I figured out that

foreach ($this->config->get('referenceFields')

doesn't always get a non-NULL value.

Casting it to array fixes it.

foreach ((array)$this->config->get('referenceFields')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions