Sorry I am a newbie to Drupal and PHP but I get this error whenever I try to create a new rule!

warning: Parameter 2 to rules_admin_form_edit() expected to be a reference, value given in C:\XAMPP\xampp\htdocs\drupal\includes\form.inc on line 372.

It may be a case realated to reported bugs about PHP 5.3.1 incompatability with Drupal 6. Eg:
http://drupal.org/node/360605#comment-2340170
http://drupal.org/node/588454#comment-2330908

I have installed everything in the last few days, including PHP 5.3.1. I did this based on the drupal installation guide, then added recommended modules.

I am trying to create a rule to clear a non-global flag (bookmark) on a node, but trying to add any rule gives me this warning, and then I cannot proceed.

As I am new to this, I would like to know how to workaround this, but also the Rules module may need updating.
So I am not sure if this is a support request or a bug report.

For the record, this lists the modules I have loaded on XAMPP

Drupal 6.15Includes: Block, Color, Comment, Database logging, Filter, Garland, Help, Menu, Node, Profile, Search, System, Taxonomy, Trigger, Update status, User

Modules
Up to dateComputed Field 6.x-1.0-beta3Includes: Computed Field
Up to dateContent Construction Kit (CCK) 6.x-2.6Also available: 6.x-3.x-dev (2010-Jan-26) DownloadRelease notes
Includes: Content, Content Copy, Content Permissions, Fieldgroup, Node Reference, Number, Option Widgets, Text, User Reference
Update availableFinder 6.x-1.6Recommended version: 6.x-1.7 (2010-Feb-02) DownloadRelease notes

Includes: Finder, Finder User, Finder Views
Up to dateFinder Wizard 6.x-3.0-beta2Includes: Finder Wizard
Up to dateFlag 6.x-1.2Also available: 6.x-2.0-beta2 (2010-Jan-08) DownloadRelease notes

Includes: Flag
Up to dateLocation 6.x-3.0Latest version: 6.x-3.1-rc1 (2009-Mar-04) DownloadRelease notes

Includes: Location, Location CCK
Up to dateRules 6.x-1.1Includes: Rules, Rules Administration UI, Rules Forms support, Rules Scheduler
Up to dateSimpleViews 6.x-1.0Includes: SimpleViews
Up to dateToken 6.x-1.12Includes: Token, TokenSTARTER
Up to dateViews 6.x-2.8Also available: 6.x-3.0-alpha2 (2010-Jan-26) DownloadRelease notes

Files: 
CommentFileSizeAuthor
#9 rules_php53fixes2.patch1.49 KBBerdir
PASSED: [[SimpleTest]]: [MySQL] 13 pass(es). View
#6 rules_php53fixes.patch881 bytesBerdir
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch rules_php53fixes.patch. View

Comments

intotech’s picture

Component: Rules Core » Rules Engine
Priority: Normal » Minor
Status: Active » Needs review

I have updated the XAMPP Simple Install instructions for Windows, to make it clearer the latest version includes an incompatible PHP version.
The Rules add rule function still needs updating as part of PHP5.3 compatibility.
I reinstalled an older version of XAMP and have got Rules working that way.

Sera’s picture

Status: Needs review » Needs work

I got nearly the same error message/warning as written above when editing existing rules. So it's not just the add-rule function, but also edit, delete, etc of rules. E.g. when I want to edit a role, I get no other options, only the warning and cannot procede.

I would appreciate a fix for the module to make it compatible with PHP 5.3.x, as I can't downgrade the existing PHP version.

Simply removing all & from the &$ - arguments within the function call seems not to work.

jaochoo’s picture

Priority: Minor » Normal

I am having the same issue: Generally, all Rules related administration pages produce a bunch of warning: Parameter 1 to rules_forms_rules_import() expected to be a reference, value given in xampplite\htdocs\drupal\includes\module.inc on line 483. This does not seem to be a problem but just looks ugly; however, same as Sera above, I cannot edit existing Rules actions: The page will produce (in addition to the warnings mentioned already) the following warning and not procees to ouput anything else: warning: Parameter 2 to rules_admin_form_edit() expected to be a reference, value given in xampplite\htdocs\drupal\includes\form.inc on line 372.

stu21774’s picture

Version: 6.x-1.1 » 6.x-1.x-dev

Same. Newbie. Mid 2009 intel mac 10.6. Using existing php, apache. Drupal 6.15

mikejonesok’s picture

Same issue. Using 5.3

Berdir’s picture

Status: Needs work » Needs review
FileSize
881 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch rules_php53fixes.patch. View

Confirmed. From what I can see, the & isn't necessary. The function is only called from the menu system and that can never be called by reference.

Status: Needs review » Needs work

The last submitted patch, rules_php53fixes.patch, failed testing.

spacereactor’s picture

i still getting warning: Parameter 1 to rules_forms_rules_import() expected to be a reference

Berdir’s picture

Status: Needs work » Needs review
FileSize
1.49 KB
PASSED: [[SimpleTest]]: [MySQL] 13 pass(es). View

Yes...

I'm not sure if the hook is supposed to be by reference, since it's 50% implements to be but documented to be not. But it doesn't make much sense to be not by reference, so I fixed the calling function and updated the documentation.

I also worked on the wrong version above, so ignore that patch, that has already been fixed.

mikejonesok’s picture

Seems to work. Thanks for the patch!

andrewfn’s picture

I am still getting the error:
warning:Parameter 2 to rules_admin_form_edit() expected to be a reference, value given in /opt/dr6/acquia/includes/form.inc on line 372.

spacereactor’s picture

Using 6.x-1.1, when i try to edit Triggered rules. warning: Parameter 2 to rules_admin_form_edit() expected to be a reference, value given in C:\xampplite\htdocs\drupal\includes\form.inc on line 372.

After i upgrade to 6.x-1.x-dev and it seem to stop the error message with rules_php53fixes2.patch
Hope this help.

Berdir’s picture

Yes, if you still see the rules_admin_form_edit() error, you are not using the -dev version.

andrewfn’s picture

Installed the dev version and re-ran the patch. No more error messages!

fago’s picture

Status: Needs review » Fixed

I committed fix from #9, thanks for the help tracking this down. Indeed the rule was never passed by reference.

Max K.’s picture

Status: Fixed » Needs work

Patch fixed error for rules_admin_form_edit() but error persists for rules_forms_rules_import() from #3 with error:

warning: Parameter 1 to rules_forms_rules_import() expected to be a reference, value given in /var/www/html/includes/module.inc on line 483.

Max K.’s picture

I've found the problem. Simply removing the ampersand from rules_forms/rules_forms.module on line 151 eliminates the problem. The only piece of information being used is $rule['#set'], so no conflicts will arise, but it wastes a small amount of memory.

klausi’s picture

Status: Needs work » Fixed

Removed the reference as suggested in #17 and committed it.

Status: Fixed » Closed (fixed)

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