I got this error on my dev site when trying to run the migrate UI (didn't get the error on my local machine):

Fatal error: rules_invoke_event(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "RulesEventSet" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in ../sites/default/modules/migrate_reviews/reviews.inc on line 239

The code on line 239 is inside the complete() function:

votingapi_add_votes(&$votes);

When I disable rules I don't get the error. Strange ...

Comments

mikeryan’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

What if you require() the rules file that defines RulesEventSet before that line in your code?

mototribe’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

The error went away after I disabled rules and re-enabled it again. Thanks

mototribe’s picture

Issue summary: View changes

added complete()

davidwbarratt’s picture

Title: Fatal error: rules_invoke_event(): » PHP Fatal error: rules_invoke_event(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "RulesEventSet" of the object you are trying to operate on was loaded _before_ unserialize()
Project: Migrate » Rules
Version: 7.x-2.2 » 7.x-2.x-dev
Component: migrate_ui » Rules Core
Category: Support request » Bug report
Priority: Normal » Major
Issue summary: View changes
Status: Closed (cannot reproduce) » Active

I created a custom module using Multi-step forms. The custom form loads the Node Form using node_form(), makes some customizations and uses the node form as the multi-step form.

This was all working perfectly on my local machine without any problems at all. However, when I put the code on the live server, I received the following error:

mod_fcgid: stderr: PHP Fatal error:  rules_invoke_event(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "RulesEventSet" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in sites/default/modules/portal/modules/portal_application/mforms/portal_application.partner.inc on line 73

Since I got a similar error in a completely different context, I'm assuming this has nothing to do with Migrate and instead has to do with Rules.

The only way I was able to fix this has been to put this code in my page callback:

 module_load_include('inc', 'rules', 'rules.plugins');
 $rules_event_set = new RulesEventSet();
 $rules_event_set->rebuildEventCache(); 

I know that is disgusting. It's re-building the Event Cache every time my form is loaded. That was the only way I could get it to work. I discovered this by clearing the Drupal cache. When I did that, I was able to load my form exactly 1 time. Refreshing the page caused the PHP error.

I'm still unable to duplicate this problem on my local machine, or provide replication steps. It seems that this is specific to the server/system configuration. If there's anything I could provide to help troubleshoot the issue please let me know, I'd like to stop using the above hack as soon as possible.

Thanks!

davidwbarratt’s picture

I'm not sure if this helps, but Line 73 (the line that invoked the PHP Error) of my custom module is:

$form = node_form($form, $form_state, $node);

Thanks!

TR’s picture

Status: Active » Postponed (maintainer needs more info)

Can you try the patch in #1541888: PHP warnings when calling method RulesEventSet::rebuildEventCache() and see if it fixes things for you? I think that may address the root cause of the error you're seeing.

TR’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No response and no steps to reproduce.