Rules fatal error during update: Call to undefined method stdClass::events() What I have tried:


Clear Cache.
Disabled module and enabled it.
Try with registry_rebuild, module_missing_message_fixer, variablecheck modules.


Still getting the below error when I try to run update.php.

Notice: unserialize(): Error at offset 668 of 1298 bytes in \sites\all\modules\entity\includes\entity.controller.inc on line 261
Warning: Creating default object from empty value in \sites\all\modules\rules\includes\rules.core.inc on line 57
Fatal error: Call to undefined method stdClass::events() in \sites\all\modules\rules\includes\rules.plugins.inc on line 767
Debugging is the art of eliminating all possible causes for your problem. Below are some attempts to help you to find the real cause of your issue ...

1. Enable Rules debugging

Something that might help you find the answer to your question, is to have a look at Rules debugging ... Within the Rules settings, experiment a bit with the debugging facilities that come with Rules. At least have a look at the "Rules Evaluation Log" (to check that the Rules logic being executed, actually matches what you expect that logic to be).

For way more details about Rules debugging, refer to the answer to "How can I display the value of a variable inside a condition?".

2. Disable all active rules and re-enable them one by one

Instead of "disable" of the Rules module (which will possible resolve your issue until you enable it again), try to leave it enabled. But start with a disable of all Active (enabled) rules.

If it is some custom rule that is causing your problem, if none of your rules are active, the problem should have disappeared also after you disabled all active rules. If that's the case, re-enable your rules again, one by one, do some test to ensure the rule you enabled did execute. Keep doing this until you hit the custom rule that makes the issue come back again. Then disable that rule again, and check if there are other remaining rules that also make the problem show up again. In the end, try to adapt the rule(s) that seem to cause the issue so that the problem no longer shows up. If you cannot solve it, do not re-enable that rule anymore and think of some alternative.

3. Special watchdog entries

Make sure to also check for any unexpected watchdog entries, it may help to get a clue about what is happening