On first install, I got the following notice:

Notice: Undefined index: flag_fetch_node_by_user in flag_rules_action_info() (line 380 of /.../sites/all/modules/contrib/flag/flag.rules.inc).
Notice: Undefined index: label in flag_rules_action_info() (line 381 of /.../sites/all/modules/contrib/flag/flag.rules.inc).

That looks like a legacy array index with no check for existence before referencing it. Line 380 of flag.rules.inc:

<?php
    $items['flag_fetch_entity_by_user'] = $items['flag_fetch_node_by_user'];
?>

I've added a test for existence and I'm submitting a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cleaver’s picture

shabana.navas’s picture

I am not sure how that would turn up an undefined index. $items['flag_fetch_node_by_user'] is the new name of $items['flag_fetch_entity_by_user']. You should always have the 'flag_fetch_node_by_user' index. It is odd why you got an undefined index there.

caschbre’s picture

So this has been plaguing me for a while. It's not happening 100% of the time, but after a cache clear I'll see this.

Basically what I see happening is flag_fetch_definition() is caching an empty value. $definitions = module_invoke_all('flag_type_info') is not returning anything. I think this depends on what is triggering the cache clearing and / or rebuilding of the flag_type_info cache. I suspect it might be tied to the Rules module but not sure. Rules is throwing all sorts of warnings/errors because it is missing the flag_type_info definitions.

So where are all of the flag_type_info implementations? In flag.flag.inc. There is a flag_hook_info() function to tell Drupal to go look in flag.flag.inc but I've run into issues before with hook_hook_info not always loading the include file promptly.

So a way to avoid this is by simply adding a module_load_include call before calling module_invoke_all. (see attached patch.)