Hi,

I was getting the notice and warning as per subject in line 573:

foreach ($data['content']['bundle']["#items"] as $key => $item) {

so in order to fix that I wrapped the foreach into an if like the following:

if (isset($data['content']['bundle']) && is_array($data['content']['bundle']["#items"])) {

Maybe somebody can review this change and produce a patch?
Unfortunately I did a quick fix to avoid flooding the logs and currently having no time to produce a patch and post it here.

Regards,

Francesco

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kevster’s picture

Thx Francesco - I hit that today after updating the module - I can confirm that worked for me and cleared the exact same error...

jdanthinne’s picture

Are you both using FacetAPI? It seems that the error is coming from the integration between those two modules (and I didn't code it myself).

FrancescoUK’s picture

Yes, I use FacetAPI.

markbannister’s picture

also use facetapi, occurred after update.

walterswa’s picture

also using facet and also occured after upgrade. Issue fixed by replacing the line with the suggestion above.

jdanthinne’s picture

Does the suggestion maintain the content exclusion function?

ntigh52’s picture

Hi all,
I also using facetapi.
I declare block custom search block and place it at the header of all my pages.
Each page view I get a lot of massages in the watchdog:

Notice: Undefined index: bundle ב-custom_search_block_view_alter() (line 573 from-/sites/all/modules/custom_search/custom_search.module).

and also


Warning: Invalid argument supplied for foreach() in-custom_search_block_view_alter() (line 573 from-/sites/all/modules/custom_search/custom_search.module).
jdanthinne’s picture

Status: Active » Needs review
FileSize
1.29 KB

Can you try the attached patch?

ntigh52’s picture

Hi @jdanthinne,
I applied your patch and from thousands PHP Notices and Warnings I get just

Searched Content for =======

when I get search results.
So I think that this patch solve that issue.
Thanks a lot.

jdanthinne’s picture

Status: Needs review » Fixed

Pushed to dev.

  • jdanthinne committed cfaff81 on 7.x-1.x
    [#2420757] by FrancescoUK,jdanthinne: test array before looping.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.