I had problems with _features_set_export_language reseting statics, but failed to do a deep copy so statics that should be kept were reset as well due to values being references.

My problem was that the admin theme wasn't used for features diff. I don't really know why that happened, because it work at first. But after an upgrade of php, or features, or Drupal core it stopped. Don't have time right now to find out exactly when it stopped working, but it seems this fix is still valid.

Comments

logaritmisk created an issue. See original summary.

logaritmisk’s picture

Status: Active » Needs review
StatusFileSize
new2.06 KB
Sneakyvv’s picture

The problem, in my opinion, is that (some of) the static variables are stored by reference. When taken into the $static variable they are still referencing the original variable. Then, when drupal_static_reset is called, also the values (references) in the $static variable are reset.

I've attached a simpeler patch which solves this problem by copying the values in a foreach, which, since it copies the values by nature, removes the references. Then this 'clean' $static_copy is used to restore the static variables.

But as mentioned in #2603578: _features_set_export_language is clearing drupal static cache too aggressively breaking search and possible many other modules , the features module can not know about each and every variable that needs to be restored. So if there's a solution there, go with that instead. Now the solution is to remove the _features_set_export_language call, but that seems to be only a workaround.

Sneakyvv’s picture

StatusFileSize
new942 bytes

Added patch with inline documentation.

b-prod’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Actually I think this patch should be applied quickly as it solved an issue that was introduced recently.

We can continue to think about a better way to handle the static variables in the issue #2603578: _features_set_export_language is clearing drupal static cache too aggressively breaking search and possible many other modules

mpotter’s picture

Status: Reviewed & tested by the community » Needs work

Discussing this over in #1988252: Use the same language consistently in generated comments and strings but putting this patch on hold till we can find a resolution to this whole language_set and static cache clearing mess instead of just trying to patch all around it.

mpotter’s picture

Status: Needs work » Closed (fixed)
mpotter’s picture

Status: Closed (fixed) » Closed (duplicate)