Closed (outdated)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Rules Core
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 May 2011 at 21:58 UTC
Updated:
16 Mar 2018 at 04:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
patrick.thurmond@gmail.comHere is the patch file.
Comment #2
patrick.thurmond@gmail.comComment #4
patrick.thurmond@gmail.comI will try again later today when I have more free time. May have to research this patching thing a bit more.
Comment #5
kanani commentedGetting the same error which persists when I make the changes suggested in OP. However eliminating line 346 entirely fixes the issue. so:
becomes
Not sure what that line is needed for anyway, as this
$element[$key]['#weight'] += $count / 1000;will add #weight to the $element array if it doesn't already exist and will update it if it does.Comment #6
kanani commentedPatch for #5 attached.
Comment #8
patrick.thurmond@gmail.comI was able to apply kanani's patch just fine using the instructions in Drupal.org's documentation. I don't know why are patches are failing other than a problem with the automated testing.
Comment #9
fagoThe test-bot is currently broken.
We need that line to initialize #weight if it's not set yet. If this is the source of the error message, most likely $element[$key] is not an array for you?
Comment #10
patrick.thurmond@gmail.comThe first patch simply forces the value to be an integer in any case and that fixed it. I think kanani was trying to simply it as well, but his approach may have introduced a new problem. Simple type casting will resolve the issue.
Comment #11
thedavidmeister commentedType casting seems to be the right way to go about this.
I'm seeing this error when the value of my $element[$key]['#weight'] is a string. Perhaps I achieved these string weights by importing/exporting rules through features, or maybe my rules were created with a legacy version of Rules, who knows...
Point is that the suggestion of the OP resolves a fatal error that appeared without warning on a production site of mine without me changing any relevant code other than pushing/reverting Features.
Type casting the weight from a string to an integer should not cause any problems.
I am using Rules 6.x-1.4
Comment #12
thedavidmeister commented#6: Unsupported-operand-types-1164220-5.patch queued for re-testing.
Comment #14
thedavidmeister commentedpatch #1 re-rolled against 6.x-1.4 attached
Comment #15
thedavidmeister commentedComment #17
thedavidmeister commentedtrying to get test bot to work..
Comment #19
thedavidmeister commentedComment #20
thedavidmeister commentedyay, test passed! that kind of took too many patches to get such a simple thing right >.<
Comment #21
thedavidmeister commentedahem
Comment #22
thedavidmeister commentedUpdate on this which might help others resolve their errors:
I was having problems getting my rules included in Features to revert at all. I uninstalled rules, manually deleted all rules hooks from my Features then installed the latest dev version of Rules and exported all of my Rules from my production site manually through the UI then re-created the Features.
This caused the fatal errors to go away. Not sure exactly what to make of that, I was previously using Rules 1.4 but it is possible that when the site was first set up an older version of Rules was used and had since been upgraded to latest stable.
Comment #23
TwoMice commentedThis issue persists in 6.x-1.x. Patch from #21 re-rolled for dev branch.
Comment #24
thedavidmeister commentedUpdate: our fatal errors came back in a later release when we re-exported Rules into Features. May have had something to do with git merging and the way that rules seems to "interleave" it's data in arrays rather than having one key-value pair per rule - this makes it very hard for humans to see what's actually getting committed each time Rules are re-exported. Entirely possible that the "bad" data that Rules is using in Features is partly due to us doing something silly in a commit or merge, but we'll probably never know.
Unfortunately we've spent more time debugging this issue than it took to pull Rules out of our system and re-implement everything the "old fashioned" way with simple hooks and API calls.
Comment #25
tr commentedDrupal 6 is no longer supported, and the code in question is different in Drupal 7.