When Features tries to determine if a component is overridden, it calls a "sanitize" function. This function is responsible for sorting and cleaning the object so it can be compared. It currently only sorts arrays. If the component contains an object, it is skipped.
If you implement an alter hook to modify a component (as with Features Override, or doing it manually), often the properties of an object will get added in a different order, causing the component to be marked as Overridden with no way to fix it.
The following patch attempts to also sort objects by their property key values. This same issue was encountered when writing the Features Override module and it had code for deeper sanitization of both arrays and objects. This patch brings over code from Features Override into a core features_sanitize function. This code was brought over in a way that Features Override can also re-use to reduce duplicate code in the future.
I've tested this pretty extensively within several Open Atrium sites. It fixes several Overrides (alters to Panelizer specifically) and doesn't seem to cause any new issues. But I need more testers on this and probably need some help writing some automated tests for this.
Patch incoming...
Comment | File | Size | Author |
---|---|---|---|
#10 | features-fix-max-nesting-level-error-2497139-10.patch | 479 bytes | das-peter |
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedComment #2
mpotter CreditAttribution: mpotter commentedComment #4
mpotter CreditAttribution: mpotter commentedNew patch to fix the missing function. Kind of a nasty namespace collision where Features Override has a function called features_get_ignore_keys(). Since this should be an internal function, I added it to Features as _features_get_ignore_keys() and changed the hook to be in the Features namespace.
If this gets removed in Features Override then any other module implementing the hook_features_override_ignore will need to change to use hook_features_ignore.
Comment #5
claudiu.cristeaThank you. This fixes the issue.
Comment #6
claudiu.cristeaSorry. The patch fixed the false override but I got a new one, also false :(
Comment #7
mpotter CreditAttribution: mpotter commentedThis doesn't necessarily fix *all* false overrides. If you mark this as "needs work" you need to be really specific about the exact override you are still getting.
Comment #8
mpotter CreditAttribution: mpotter commentedCommitted to 1905744.
Comment #10
das-peter CreditAttribution: das-peter at Cando commentedSorry, I've to re-open this.
I'm exporting rules configuration entities and this patch causes "Fatal error: Maximum function nesting level of '500' reached, aborting!" errors.
The reason seems to be that you can't just cast a rules entity object to an array (using
(array)
), I'm assuming the issues is caused by the fact that a rules entity objects work with iterators.The attached patch uses
get_object_vars()
to fetch the public available properties as an array - this seems to work fine so far.However, I can't tell if the desired behaviour of this patch suffers from this change.
Comment #12
mpotter CreditAttribution: mpotter commentedThanks! Nice catch. Interesting that it all worked for ctools, views, entity, but not for Rules. I tested your patch and it still seems to work fine and handles the original issue. I've committed this fix to b9f90cc so it will be in the 2.6 release later this week.
Comment #14
a.milkovskyStrange, but the #10 patch caused a big issue for me. Rules were not exported properly after update to 7.x-2.6. features_sanitize() only returned some general rules info(label, tags) but did not include rules actions, conditions.
I had to revert the fix.
Comment #15
geek-merlin@a.milkovsky: I fixed this regression in #2701957: Rules deployment breaks, due to overridden rules not recognized - you may want to test that patch and set this issue RTBC.