When I try to execute a twitter action (post a tweet) from a triggered rule, the action is (apparently) not executed and I get the following warning displayed on screen:

warning: Parameter 1 to rules_core_action_execute() expected to be a reference, value given in /srv/www/html/sites/all/modules/rules/rules/rules.module on line 603.

... no message is posted to twitter. A spot of debug code tells me the warning happens when the rules_element_invoke() function does call_user_func_array() for the above function with the twitter_actions_set_status_action action as parameter.

I expect it may be because I run PHP 5.3. I would fix it, but I'm not quite sure where to start.


cafuego’s picture

Oh, I should add that twitter_actions_set_status_action() is never actually executed; I inserted a dpm() call as the first line of the function and it prints nothing.

Szilárd Pfeiffer’s picture

Same problem with PHP version 5.3.2. The value of the first item of the variable params in function rules_element_invoke is NULL, but the user function (rules_core_action_execute) want an object reference as it's first parameter.

lordgilman’s picture

Updating to the latest Debian stable bumped me from php 5.2 to 5.3 and introduced this bug for me as well.

ajzz’s picture

Same issue here with twitter action (PHP 5.3.2). Other actions work fine, so this seems like a twitter module issue.

php|error| Parameter 1 to rules_core_action_execute() expected to be a reference, value given in /var/www/host/sites/all/modules/rules/rules/rules.module on line 603.

hedac’s picture

same error here... it's crazy all the bugs in all modules php 5.3 introduce.

hedac’s picture

Status: Active » Fixed

I'm so glad that I could fix this myself... but it is a Rules fix.. not Twitter actions fix.

in rules.rules.inc
replace: function rules_core_action_execute(&$object, $settings, $element, &$state) {
with: function rules_core_action_execute($object, $settings, $element, &$state) {

ajzz’s picture

Status: Fixed » Needs review

Hi hedac, can you confirm that this does not break other rules that are triggered at the same time? if so, please move this post to the issue queue of the rules project so the maintainers there can roll out a patch. thanks!

hedac’s picture

Project: Twitter » Rules
Version: 6.x-3.0-beta3 » 6.x-1.x-dev
Component: Twitter Actions » Rules Engine

I have some rules with multiple actions and so far it seems to work.
But review from the Rules team would be great.
moving to rules project issues.

cafuego’s picture

The fix doesn't break other actions on the site I applied it to - but those other actions also didn't trigger the problem, so I expect they're being called differently.

fago’s picture

Status: Needs review » Fixed

As we dropped php 4 compatibility already, the fix is fine. Committed.

Status: Fixed » Closed (fixed)

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

cafuego’s picture

Are you able to release Rules 1.5 and so include this fix in a stable version? It's been ages since 1.4 and I'm hesitant to stick a -dev version on a production site.