Noticed that a bunch of drupal_goto() got introduced over in this CiviCRM Entity Actions PR.

This can be problematic because drupal_goto() calls drupal_exit(), which will prevent the firing of any future events / rules / actions.

Comments

xurizaemon created an issue. See original summary.

markusa’s picture

Assigned: Unassigned » xurizaemon

Do you have a proposed alternative?

markusa’s picture

@xuridaemon

Have you had any ideas, or had any time to spend on this issue?

markusa’s picture

Status: Active » Postponed (maintainer needs more info)
xurizaemon’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new61.71 KB

The information you might need though is that drupal_goto() terminates the request (see drupal_goto - we make sure none of the code below the drupal_goto() call gets executed upon redirection).

If this function is used in a Rules Action, then the UI will permit people to add actions following the action that contains a drupal_goto, but those actions will never be executed. Neither will any other behaviour attached to the page at a later point than the rule, which means this implementation permits a range of unexpected outcomes.

Probably more robust would be to use rules_action_drupal_goto() in place of drupal_goto(), as it contains code to handle this specific concern.

PR @ https://github.com/eileenmcnaughton/civicrm_entity/pull/129

Untested :)

xurizaemon’s picture

Patch @ https://github.com/eileenmcnaughton/civicrm_entity/pull/129.patch updated, forgot to upload here!

This addresses the Rules dependency in previous approach by wrapping the Rules function in a wrapper which will use drupal_goto in the event that Rules isn't available.

xurizaemon’s picture

StatusFileSize
new131.33 KB

  • xurizaemon committed 871484e on 7.x-2.x
    Issue #2806011. Implement our own Rules-preferring goto wrapper....
  • markusa authored 9876759 on 7.x-2.x
    Merge pull request #129 from xurizaemon/7.x-2.x-2806011-...
  • xurizaemon committed b7eec4e on 7.x-2.x
    Issue #2806011. Avoid calling drupal_goto() directly from rules actions.
    
markusa’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.