not sure how this related to previous issues on the 2.x branch. I am using all -dev modules on this test site.

array_merge(): Argument #2 is not an array flag_flag.inc:187                                                                           [warning]
Invalid argument supplied for foreach() flag_flag.inc:206                                                                              [warning]
array_merge(): Argument #2 is not an array flag_flag.inc:187                                                                           [warning]
PHP Fatal error:  Unsupported operand types in sites/all/modules/flag/includes/flag/flag_flag.inc on line 118

Fatal error: Unsupported operand types in sites/all/modules/flag/includes/flag/flag_flag.inc on line 118
Drush command terminated abnormally due to an unrecoverable error.                 
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Active » Postponed (maintainer needs more info)

Looks like everything starts going wrong here:

    $link_type = $this->get_link_type();
    $options = array_merge($options, $link_type['options']);

What's your flag link type? is it a module that's caught up with 3.x API changes yet?

likewhoa’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

i was in a hurry thus reverted back to 2.x-dev.

justkristin’s picture

Version: 7.x-3.x-dev » 7.x-3.2
Issue summary: View changes
Priority: Normal » Major
Status: Closed (cannot reproduce) » Active
Issue tags: +flag wsod

I have reproduce this, unhappily. The error appears, as shown below, in my apache error log. A few of the triggers were off-site, and I have no idea why they would even be the source of these errors, as our site is unknown...

Anyway, my info file reads:

; Information added by drupal.org packaging script on 2013-09-13
version = "7.x-3.2"
core = "7.x"
project = "flag"
datestamp = "1379063829"

Not sure what to try now, as I am WSODed.

[Tue Nov 12 17:34:07 2013] [error] [client 69.59.94.72] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130, referer: http://mannerofspeaking.org/2011/06/04/rhetorical-devices-introduction/
[Tue Nov 12 17:34:43 2013] [error] [client 174.68.89.26] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:34:58 2013] [error] [client 180.76.5.200] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:36:10 2013] [error] [client 157.56.93.50] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:36:20 2013] [error] [client 157.56.93.50] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:37:08 2013] [error] [client 180.76.5.195] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:37:19 2013] [error] [client 50.137.8.135] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130, referer: http://mannerofspeaking.org/2011/09/29/ten-tips-for-using-props-in-a-presentation/
[Tue Nov 12 17:37:25 2013] [error] [client 66.249.73.29] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:37:30 2013] [error] [client 157.55.33.78] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
[Tue Nov 12 17:37:40 2013] [error] [client 157.55.33.78] PHP Fatal error:  Unsupported operand types in /var/www/www.site.org/htdocs/sites/all/modules/flag/includes/flag/flag_flag.inc on line 130
joachim’s picture

Version: 7.x-3.2 » 7.x-3.x-dev
Status: Active » Postponed (maintainer needs more info)
Issue tags: -flag wsod

Can you provide a backtrace please?

And actually, debug output of the variables at the problem point would be needed too.

This is probably a misbehaving module which is not providing the right data at this point. Do you have any Flag ecosystem modules installed? Are they updated for 3.x?

joachim’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Duplicate of #1925922: Unsupported operand types in factory_by_row() in flag_flag.inc.

Please, somebody do some debugging!!!

msti’s picture

Have the same error with : flag 7.x-3.5

[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP Fatal error:  Unsupported operand types in /development/drupal-dev/sites/all/modules/flag/includes/flag/flag_flag.inc on line 132, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP Stack trace:, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   1. {main}() /development/drupal-dev/index.php:0, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   2. menu_execute_active_handler() /development/drupal-dev/index.php:55, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   3. call_user_func_array() /development/drupal-dev/includes/menu.inc:517, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   4. block_admin_display() /development/drupal-dev/includes/menu.inc:0, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   5. block_admin_display_prepare_blocks() /development/drupal-dev/modules/block/block.admin.inc:34, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   6. _block_rehash() /development/drupal-dev/modules/block/block.admin.inc:52, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   7. module_invoke() /development/drupal-dev/modules/block/block.module:388, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   8. call_user_func_array() /development/drupal-dev/includes/module.inc:866, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP   9. views_block_info() /development/drupal-dev/includes/module.inc:0, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  10. views_get_all_views() /development/drupal-dev/sites/all/modules/views/views.module:604, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  11. ctools_export_crud_load_all() /development/drupal-dev/sites/all/modules/views/views.module:1434, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  12. ctools_export_load_object() /development/drupal-dev/sites/all/modules/ctools/includes/export.inc:148, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  13. _ctools_export_get_defaults() /development/drupal-dev/sites/all/modules/ctools/includes/export.inc:496, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  14. flag_bookmark_views_default_views() /development/drupal-dev/sites/all/modules/ctools/includes/export.inc:680, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  15. flag_get_flag() /development/drupal-dev/sites/all/modules/flag/flag_bookmark/includes/flag_bookmark.views_default.inc:14, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  16. flag_get_flags() /development/drupal-dev/sites/all/modules/flag/flag.module:1863, 
[Fri Jan 23 14:11:51 2015] [error] [client 127.0.0.1] PHP  17. flag_flag::factory_by_row() /development/drupal-dev/sites/all/modules/flag/flag.module:1919, 
lunk rat’s picture

Would this have anything to do with a namespace conflict? I am getting this error when I name my module functions "mymodule_rules_something" but when I rename the functions to "mymodule_something" (without 'rules') I no longer see the error.

rubymuse’s picture

I am experiencing this on a site in development. After clearing caches, the error suddenly showed up:
Fatal error: Unsupported operand types in sites\all\modules\flag\includes\flag\flag_flag.inc on line 132

I commented out the code I've been working on for the past several hours (having nothing to do with flags); no change.

I'm using Flag version = "7.x-3.6" with several node flags. I'm not aware of having any Flag 'ecosystem' modules installed.

After manually disabling the module and clearing caches in the database, I got these messages when reloading the site:

Deprecated function: Call-time pass-by-reference has been deprecated in drupal_load() (line 1120 of ...\includes\bootstrap.inc).
Notice: Undefined index: normal in flag_flag->get_link_type() (line 1202 of ...\flag\includes\flag\flag_flag.inc).
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in flag_flag->options() (line 203 of ...\flag\includes\flag\flag_flag.inc).
Warning: Invalid argument supplied for foreach() in flag_flag->construct() (line 222 of ...\flag\includes\flag\flag_flag.inc).

And I've since determined that disabling the module and clearing just cache_bootstrap brings the site back.

Sure hope that helps...I miss my Flags.

dang42’s picture

FileSize
145 KB

Just got the same error as rubymuse - caused WSOD on my local version (but not the version on the server ... yet?)

Attached is a screenshot of what I get when I add the 3-lines of error reporting code to index.php.

I've no clue how to fix this, but I'll be happy to provide as much info as I can to anyone who does. This is a serious issue for me right now, that will become critical if it affects our production site. Any / all help will be much appreciated!

Thanks,
Dan

eta -> using v3.6

eta #2 -> wsod gone by switching to v3.6-dev. I'll still be happy to provide debug info by switching back to 3.6 if it'll help someone track down the source for others.

kambingfazil’s picture

Just update the Flag module, problem solved :D

Louis Delacretaz’s picture

With ver 3.6 starting getting this error after clearing all caches.

Fatal error: Unsupported operand types in sites/all/modules/flag/includes/flag/flag_flag.inc on line 132

updated to 3.7 and then "7.x-3.7+2-dev", still getting same error.

Note with each version drush cc all throws 3 warnings prior.
array_merge(): Argument #2 is not an array flag_flag.inc:203 [warning]
Invalid argument supplied for foreach() flag_flag.inc:222 [warning]
array_merge(): Argument #2 is not an array flag_flag.inc:203 [warning]
PHP Fatal error: Unsupported operand types in sites/all/modules/flag/includes/flag/flag_flag.inc on line 132

Is there any other info I can supply?
Like Dan this is on a dev site with is a mirror of a live site.
cheers
Louis

Louis Delacretaz’s picture

I rolled the database back some 12 hours and the problem went away.
Given this is a dev site that was in the process of having memcached installed as well as running some very development
modules I wonder if some flags got corrupted and caused my issue. We are making extensive use of flags.

However Im now running flag v3.6 and not experiencing any problems. Will report back if the issue re-occurs.

Louis Delacretaz’s picture

error suddenly came back, then started reporting the same error was occurring in entity.views.inc

Manually clearing the cache table has cleared the error.

Should there be a test for empty options at line 132 or 203?

Naresh Kmr’s picture

Got this error in my local environment when I tried to clear cache using drush. (drush cc all).
Manually clearing the cache table has cleared my error as well. Thanks @Louis Delacretaz

slefevre1’s picture

Which cache table did you clear manually? cache? I truncated that table but it didn't solve the problem. Normally a drush rr fixes it, but this time it is stubborn.

I've been having this problem off and on with backports for years, I wish they would put a check in this, or at least stub out an empty array in $flag->options().

slefevre1’s picture

This checks to see that it is an array before it merges.

vrwired’s picture

Ran into this issue only on production server... seems issue happens w/ AWS. Comment #13 led to the right patch for us at https://www.drupal.org/project/flag/issues/1925922#comment-12407413