Closed (fixed)
Project:
HTML Title
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 May 2024 at 20:23 UTC
Updated:
2 Oct 2025 at 06:29 UTC
Jump to comment: Most recent
For some reason the 'breadcrumb' key is sometimes not in $vars in the preprocess breadcrumb hook.
The error shows up as a warning on the site.
Warning
: foreach() argument must be of type array|object, null given in
/var/www/html/docroot/modules/contrib/html_title/html_title.module
on line
88I'm trying to use Breadcrumbs with facetted search connected to solr and the error shows up when there's no search parameters.
Add a simple check for the 'breadcrumb' keys in the $vars array in the preprocess_breadcrumb hook.
Review.
None.
None.
None.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
dmlb2000 commentedComment #5
quadrexdev"isset" check should be enough even though
is supposed to be an empty array by default. Please see
Comment #6
vitaliyb98 commentedThis issue could not be reproduced on a "fresh install" without other modules. However, one possible cause is the order in which hook_preprocess_breadcrumb functions are executed. In this module, html_title_preprocess_breadcrumb is hardcoded to run after all other preprocess functions.
As a result, this problem can occur if a contributed module or custom code does something like the following:
In my opinion, committing this fix will improve the stability of the module.
Comment #7
vitaliyb98 commentedMerged into 8.x-1.x, thanks