Currently, actions (defined in database) are invoked as follows on lin 99 of actions.inc
$result[$action_ids] = $function($object, $context, $a1, $a2);
This creates problems where a trigger/action may be defined in the database, but a module supporting the action $function is disabled, resulting in a showstopping fatal error, which you'd need to manually edit the database to fix. Bad news!
This can be prevented by using call_user_func() as we do in a number of other places:
$result[$action_ids] = call_user_funct($function, $object, $context, $a1, $a2);
That will simply return FALSE if for some reason the action function is undefined. I can roll a patch against 6.x-dev if that helps.
Comments
Comment #1
damien tournoud commentedBumped to D7. This will need to be wrapped into a function_exists for D6 and a drupal_function_exists for D7.
Bumped to critical because that's something that should have been converted when the registry patch landed in D7.
Comment #2
jbomb commentedattached is the requested patch from #1.
Comment #3
webchickWe should probably expand our tests to cover this case, no?
Comment #4
pp commentedHow do I reproduce the bug?
I think the patch is not good. I saw the actions.inc and found two place where problem presents the patch just resolve one.
85. and 100. line contains:
$result[$action_id] = $function($object, $context, $a1, $a2);
pp
Comment #5
sunTagging.
Regarding tests, please see #582316: Add tests for actions. It makes no sense to hold off this patch, because we have no tests and especially no pattern for tests for actions yet.
Comment #6
dawehnerThe actions return NULL. So FALSE is a sign of an error. Thanks for explaining me this sun.
Thats also good for testing this functionality later.
Comment #7
dries commentedCommitted to CVS HEAD. Marking 'code needs work' because we need tests.
Comment #8
dries commentedComment #9
dave reidThis also should be backported to D6.
Comment #10
dawehnerupdated patch.
Comment #12
dawehnerThere seems to be a bug in git diff, the identation got lost.
Comment #13
andypostIt works, also re-roll against current DRUPAL-6
Comment #14
gábor hojtsyGreat, committed, thanks.
Comment #15
andypostThere's a similar issue which proposes UI change to cleanup orphaned actions #306540: Orphaned assigned actions still triggered and cannot be removed
@Gábor could you comment: is this change possible?