I am getting this error:
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of /hsphere/local/home/...../sites/all/modules/flag/flag.inc
According to the docs for http://api.drupal.org/api/drupal/modules!system!system.api.php/function/..., the 'triggers' property is not optional.
Hence this is another contrib module that's misbehaving, and isn't something that Flag should have to fix.
But how I can know which module misused this hook?
Comment | File | Size | Author |
---|---|---|---|
#21 | flag_inc.patch | 541 bytes | SerKi |
#11 | flag.inc_.txt | 55.03 KB | hubobbb |
#10 | flag-notice-undefined-index-1356786-10.patch | 526 bytes | larskleiner |
Comments
Comment #1
Musicious CreditAttribution: Musicious commentedme too, when I go to actions.
This could be the source of other problems I am having... I hope.
Comment #2
dojorob76 CreditAttribution: dojorob76 commentedI get the same message when going to Actions.
Comment #3
Musicious CreditAttribution: Musicious commentedI think this is messing up another action I have set to trigger based on a flagging event.
If I sort this I will report back... please do the same.
Will.
edit:
Full error message is....
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of /var/aegir/static/thinkingskills-7.9/sites/all/modules/flag/flag.inc).
and appears here... admin/structure/flags/actions/add/flagname
Comment #4
kaizerking CreditAttribution: kaizerking commentedyes here also same
Comment #5
mvinas CreditAttribution: mvinas commentedSame problem here
Comment #6
mvinas CreditAttribution: mvinas commentedI replace the problematic line 1334 of flags.inc from:
if ($action['type'] != 'node' && !in_array('any', $action['triggers'])) {
to
if ($action['type'] != 'node' && (!isset($action['triggers']) || !in_array('any', $action['triggers']))) {
It worked for me
Comment #7
kaizerking CreditAttribution: kaizerking commentedit should be flag.inc
Thanks , it worked for me too
Comment #8
heronog CreditAttribution: heronog commentedEDITED wrong thread
Comment #9
blogook CreditAttribution: blogook commentedWhat is the correct thread? because i have a similar problem.
Edit: Lol nevermind ..
Comment #10
larskleiner CreditAttribution: larskleiner commentedThanks mvinas, works for me too.
Comment #11
hubobbb CreditAttribution: hubobbb commentedThanks #10 larskleiner ;
your path file works sucessfully. but the problem is still have .like this :
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Notice: Undefined index: triggers in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
Warning: in_array() expects parameter 2 to be array, null given in flag_node->get_valid_actions() (line 1334 of D:\wamp\www\t7\sites\all\modules\flag\flag.inc).
the flag.inc is here .
Tks again .
Comment #12
Drunoober CreditAttribution: Drunoober commentedSame problem here.... :(
did you figure it out?
I think this problem cripples the Flag_solve module too.
pls need help. thanks
Comment #13
ZetaTrooper CreditAttribution: ZetaTrooper commentedThis worked for me for the Node Abuse actions.
However, when I try to set up an action for the Comment Abuse, I get a similar but different error:
Notice: Undefined index: triggers in flag_flag->get_valid_actions() (line 887 of ....|sites|all|modules|flag|flag.inc).
If I replace line 887: if ($action['type'] != $this->content_type && !in_array('any', $action['triggers'])) {
with: if ($action['type'] != $this->content_type && (!isset($action['triggers']) || !in_array('any', $action['triggers']))) {
The error goes away for me.
Comment #14
rogical CreditAttribution: rogical commentedCan we re-roll a complete patch?
Comment #15
joachim CreditAttribution: joachim commentedThis change doesn't look right to me.
The flag_flag class is generic to all content types. It shouldn't be assuming anything about subclasses.
The fix in 13 looks better, but as said above, needs rolling as a patch.
Comment #16
BeaPower CreditAttribution: BeaPower commentedwill this be committed?
Comment #17
joachim CreditAttribution: joachim commentedThe patch needs work first.
Comment #18
knsheely CreditAttribution: knsheely commentedI applied the patch from 10 and now I am getting the following notice when I try to add an action.
Notice: Undefined index: label in flag_actions_form() (line 426 of /home/fourc/public_html/profiles/idea/modules/contrib/flag/flag_actions.module).
Notice: Undefined index: label in flag_actions_form() (line 426 of /home/fourc/public_html/profiles/idea/modules/contrib/flag/flag_actions.module).
Notice: Undefined index: label in flag_actions_form() (line 426 of /home/fourc/public_html/profiles/idea/modules/contrib/flag/flag_actions.module).
Notice: Undefined index: label in flag_actions_form() (line 426 of /home/fourc/public_html/profiles/idea/modules/contrib/flag/flag_actions.module).
Notice: Undefined index: label in flag_actions_form() (line 426 of /home/fourc/public_html/profiles/idea/modules/contrib/flag/flag_actions.module).
Notice: Undefined index: label in flag_actions_form() (line 426 of /home/fourc/public_html/profiles/idea/modules/contrib/flag/flag_actions.module).
edit: When making the change from #13 the notices are gone. anyone want to roll that patch?
Comment #19
joachim CreditAttribution: joachim commentedPlease bear in mind my comment in #15.
Comment #20
SerKi CreditAttribution: SerKi commentedmm no exist in line 1334 flag.inc if ($action['type'] != 'node' && !in_array('any', $action['triggers'])) { , the problem is in line 1036 in beta, and .dev also in /includes/flag_flag.inc
Comment #21
SerKi CreditAttribution: SerKi commentedComment #22
joachim CreditAttribution: joachim commentedThis is going to need to be fixed on 3.x first, then backported.
Comment #23
joachim CreditAttribution: joachim commentedAh, I see you've filed a 3.x patch over at #1778444: flag Notice: Undefined index: triggers flag_flag->get_valid_actions() patch. The way a bug across multiple branches is handled is that the same issue gets used, first on the newest branch and then working back.
Comment #24
joachim CreditAttribution: joachim commentedAccording to the docs for http://api.drupal.org/api/drupal/modules!system!system.api.php/function/..., the 'triggers' property is not optional.
Hence this is another contrib module that's misbehaving, and isn't something that Flag should have to fix.
Comment #25
jastraat CreditAttribution: jastraat commentedFor anyone who is checking this issue, I've added an issue in the pathauto issue queue:
http://drupal.org/node/1796920
I'm not sure that I fully agree that the trigger property is required based on the documentation though.
Comment #26
Dave ReidPathauto is fixed now in both 7.x-1.x-dev and 6.x-2.x-dev. Sorry about that.
Comment #27
krystlc CreditAttribution: krystlc commentedI got a similar error using Flag 7.x-3.2
So I opened that file and edited that line and replaced:
if ($action['type'] != $this->entity_type && !in_array('any', $action['triggers'])) {
with:
if ($action['type'] != $this->entity_type && (!isset($action['triggers']) || !in_array('any', $action['triggers']))) {
slightly different from #21's patch (note entity_type)
so far no errors.
Comment #28
joachim CreditAttribution: joachim commentedYou should not have to make that hack.
See my comment #24 above -- if $action['triggers'] is not set, then a module somewhere is not returning the proper thing from a hook.
Comment #29
ofry CreditAttribution: ofry commentedHow I can found which another contrib module misused this hook_action_info?
Comment #30
ofry CreditAttribution: ofry commentedComment #31
joachim CreditAttribution: joachim commentedSearch your codebase for implementations of the hook.
Comment #32
jay.lee.bio CreditAttribution: jay.lee.bio commentedOfry, it's definitely Pathauto (7.x-1.2) that's causing this issue. The error message disappeared after I disabled it, so try using 7.x-1.x-dev (#26, which I haven't tried yet).
Comment #33
marcel.jtf CreditAttribution: marcel.jtf commentedSame problem here. @wwwjaylee, I do not use pathauto and still have this error.
Comment #34
jay.lee.bio CreditAttribution: jay.lee.bio commentedDwp, then it's probably another module. You'll have to disable one by one until you find the source. Maybe it's a module you recently added, I don't know. Good luck.