Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I get a fatal error when installing rules via drush
-sh-4.1$ drush dl rules
Project rules (7.x-2.6) downloaded to sites/all/modules/rules. [success]
Project rules contains 4 modules: rules_admin, rules_i18n, rules_scheduler, rules.
-sh-4.1$ drush en rules
The following extensions will be enabled: rules
Do you really want to continue? (y/n): y
PHP Fatal error: Call to undefined function rules_invoke_event() in /home/.../public_html/sites/all/modules/rules/modules/events.inc on line 180
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Call to undefined function rules_invoke_event() in
/home/.../public_html/sites/all/modules/rules/modules/events.inc,
line 180
All the site is broken when I try to access it, and I see such errors in the log
[Sat Dec 28 20:04:42 2013] [warn] [client 91.120.170.116] mod_fcgid: stderr: PHP Notice: Undefined index: event_info in /home/.../public_html/sites/all/modules/rules/rules.module on line 227
[Sat Dec 28 20:04:42 2013] [warn] [client 91.120.170.116] mod_fcgid: stderr: PHP Fatal error: Unsupported operand types in /home/.../public_html/sites/all/modules/rules/rules.module on line 227
L
Comment | File | Size | Author |
---|---|---|---|
#6 | rules--call_to_undefined-2163971-6.patch | 412 bytes | pescetti |
Comments
Comment #1
giorgio79 CreditAttribution: giorgio79 commentedRight project...
Comment #2
aangel CreditAttribution: aangel commentedI too am getting this error. Going to try 2.5.
Comment #3
aangel CreditAttribution: aangel commented2.5 worked for me atop a Panopoly + Kalatheme distribution.
Comment #4
Ronino CreditAttribution: Ronino commentedI can confirm this for rules-7.x-2.7, but it only happens when trying to enable the module with drush. It works without any errors when enabling it via the modules page or with module_enable() in an update hook which can be triggered with drush updb.
Comment #5
giorgio79 CreditAttribution: giorgio79 commentedAh, I did use drush as well...
Comment #6
pescetti CreditAttribution: pescetti commentedIssue is due to Rules implementing
hook_watchdog
and Drupal (when the module is enabled via Drush) invoking that hook, and Rules' implementation of it, before the module is actually fully enabled and the functions defined inrules.module
are actually visible.This happens when Drupal tries to write "Rules module installed" and "Rules module enabled" into watchdog.
The attached patch works around the problem by calling
rules_invoke_event()
only when the function is actually visible. It is a minimal workaround with no effects on the ordinary module operations.Comment #7
JeremyFrench CreditAttribution: JeremyFrench commentedThis patch looks ok and resolves the issue for me.
Comment #8
JeremyFrench CreditAttribution: JeremyFrench commentedComment #9
fagoI do not see how it can happen that events.inc is included, but the module file not. If so, that's maybe some misbehaviour of drush?
I also tested it with the recent dev version and drush 6.4 and was not able to reproduce it.
However, there seems to be some general issues related firing Rules events too early - see #2324587: Rules might be triggered too early in the bootstrap. So let's make that more bullet-proof over there, which should help with problems like that also. I leave the issue open for now, in case more people run into it. If so, please try to reproduce it with the latest dev version.
Comment #10
TR CreditAttribution: TR commentedAs @fago said in #9, it's unclear why this would happen in events.inc and not in rules.module (rules.module gets loaded first, after all..). There have been no reports of this problem re-occurring in the past 4 years, so it's likely it no longer happens in the current versions of Rules and drupal.
Again, as @fago said, let's work on the more basic issue over in #2163971: Call to undefined function rules_invoke_event() in on line 180 and Unsupported operand types inrules.module on line 227
If this problem still happens, please open a NEW issue with current information and details for how to reproduce the error.