Hello
I get this error message when trying to reindex content on the solr configuration page

warning: Invalid argument supplied for foreach() in /var/www/drupal-6.20/sites/all/modules/solr_flag/flag_solr.module on line 18.

Then the search worked but I get error message as well on the search result page
#

*
... (Object) stdClass
o
im_vid_1 (Object) stdClass
+
1 (Integer) 19
+
2 (Integer) 17
o
bs_flag_bookmarks_flagged (Object) stdClass
+
true (Integer) 1
*
Krumo version 0.2a
| http://krumo.sourceforge.net
Called from /var/www/drupal-6.20/sites/all/modules/solr_flag/flag_solr.facets.inc, line 495

and this other error message on search result page

file attached

I am running on solr 6.x-2.0-beta3

Regards

Comments

mooffie’s picture

Priority: Normal » Critical

(Sorry for not replying earlier: I wasn't "subscribed".)

warning: Invalid argument supplied for foreach() in [...]/flag_solr.module on line 18.

Mmmm. I see that flag_get_content_flags() returns NULL, not an empty array, when a node isn't flagged. It's amazing that I haven't encountered this bug before.

joe_pixelrow’s picture

can you show us specifically what to fix, or post a patch for this problem, I am getting the same errors as we start to add content

julien’s picture

StatusFileSize
new1.54 KB

Hi,

Just found that the issue is only appearing when a node have never been flagged.
it just needed a check if the $flaggings_by_user exist to fix it.

mooffie’s picture

I've committed the patch (a very similar one, anyway). Please check it out. If it solves the problem, please close this issue.

julien’s picture

By the way, i haven't been able to display the block facets, even with reindexing the content in Solr.
Did you change the schema.xml to index the flag field in Solr ?
When i bookmark a node and run the cron, i can see that it's going to be commited to solr.
but the block doesn't appear, any idea why?