Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Overview
I get a fatal error when running features revert on a module with rules defined.
Error
<b>Fatal error</b>: Unsupported operand types in <b>/.../sites/all/modules/contrib/rules/includes/rules.plugins.inc</b> on line <b>495</b><br />
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Unsupported operand types in
/.../sites/all/modules/contrib/rules/includes/rules.plugins.inc, line 495
(Possibly) Steps to reproduce
- Create a feature module with a rule
- Run "drush fr [module]"
Note that it's unclear if my features module has something special about it that is causing it to run into the error.
Fix
I'll add a patch but the fix is to initialize the array:
$export = array();
Comment | File | Size | Author |
---|---|---|---|
#17 | fix-unsupported-operand-types-on-feature-revert--2186363-17.patch | 1.35 KB | q11q11 |
#13 | 2186363-13.patch | 1.34 KB | TR |
#8 | Screen Shot 2016-10-19 at 2.47.21 PM.png | 371.53 KB | lathan |
#5 | rules-fix-fatal-error-features-revert-2186363-2.patch | 1.34 KB | Arne Slabbinck |
| |||
#1 | rules-fix-fatal-error-features-revert-2186363-1.patch | 815 bytes | Kristen Pol |
Comments
Comment #1
Kristen PolHere's the patch.
Comment #2
Kristen PolSince this is a fatal error, I think it should be bumped in priority.
Comment #3
dkane CreditAttribution: dkane commentedThank you Kristen! I was getting the same error and your patch solved my issue!
Comment #4
cuppensh CreditAttribution: cuppensh commentedI get the same error in version 7.x-2.9. The patch from Kristen resolves the problem.
Comment #5
Arne Slabbinck CreditAttribution: Arne Slabbinck commentedThe patch #1 from Kristen solved the fatal error (Thanks!), but I still had warnings cause apparently my $export was empty. This happens when creating a feature.
(Using D 7.4 , PHP 5.5.46, Rules 7.x-2.9)
So adjusted the patch to check if $export has a value.
Comment #6
Daniel Wentsch CreditAttribution: Daniel Wentsch commentedThanks a lot, should be committed.
Comment #7
dandaman CreditAttribution: dandaman commentedI also found this fixed an issue with a Feature and Rules that was created years ago and it wouldn't let me view Feature status or recreate the Feature until I applied patch #5.
Comment #8
lathanThis bug completely wrecked our site. To the point the point where we had massive amounts of dead locks happening, I assume because system clean up could not happen on cron.
Attached is screen shot of how this effected us.
The attached patch is live on our production site.
+1 RTBC
Comment #9
tanmaykPatch in #5 works fine. +1 for RTBC.
Comment #10
AlfTheCat CreditAttribution: AlfTheCat commentedPatch in #5 works, thanks!
Comment #11
fagoIs this still necessary? Also the patch has some coding style issues (whitespace after if missing)
Comment #12
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commentedThis is still happening to me when I attempt to export a schedule rules event.
Comment #13
TR CreditAttribution: TR commentedI don't see anything disruptive in the proposed fix - this shouldn't affect any existing code. There's probably a better place to fix this issue, but there's no harm in adding a little defensive coding in Rules ...
Here's a new patch against the current HEAD, with the coding standards issues fixed. Can someone review this patch and confirm that it works to prevent the problem?
Comment #14
TR CreditAttribution: TR commentedComment #15
TR CreditAttribution: TR commentedA virtually identical patch was committed in #2191425: Exceptions in Features UI if Rule lacks event configuration to solve a different issue. It should solve this one too.
Comment #17
q11q11 CreditAttribution: q11q11 as a volunteer commentedRerolled #13 against 7.x-2.12, same code, just with offsets.