I have a site with some complex rules, including rules that schedule rules for later. The update to 2.1 has broken one of the rules, I don't know which, with the error message:

Argument 7 passed to rules_action_mail() must be an instance of RulesState, instance of RulesAction given

I'll keep digging to see if I can find where the problem is coming from.

Has also been reported on a Drupal Commerce site: #1496964: Recoverable fatal error rules_action_mail()

Comments

fonant’s picture

Component: Rules Core » Rules Engine

Rules 2.0 has:

function rules_action_mail($to, $subject, $message, $from = NULL, $settings, RulesState $state, RulesPlugin $element)

and the new Rules 2.1 with i18n has:

function rules_action_mail($to, $subject, $message, $from = NULL, $langcode, $settings, RulesState $state, RulesPlugin $element)

so the function signature has indeed changed. So we need to find where rules_action_mail() is being called and add an additional argument at position 5 for $langcode.

fonant’s picture

Looks like the function calls are stored in the serialized Rule data in the database. So we need some code to update that data to add in the additional $langcode argument for previously-stored rules.

fago’s picture

Status: Active » Fixed

You need to clear your caches, then it should work just fine.

fonant’s picture

Thanks! The fix was as simple as that. Odd, as I thbought the caches had been cleared, but I can't have done.

Status: Fixed » Closed (fixed)

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

phillipclarke29’s picture

Component: Rules Engine » Rules Core

I have just started working on a site and the second rule, to notify node authors of a new comment using rules 7.x-2.2 has come up with the error

Recoverable fatal error: Argument 7 passed to rules_action_mail() must be an instance of RulesState, instance of RulesAction given in rules_action_mail() (line 78 of /opt/bitnami/apps/drupal/htdocs/sites/all/modules/rules/modules/system.eval.inc).

Looking a the previous posts I am still not sure what to do - I have tried clearing caches but it still does not work.

phillipclarke29’s picture

Issue summary: View changes

Added link to Commerce issue with same error.