In my install profile generated by Profiler Builder for a project https://github.com/victorkane/lit-drupal-lean, error messages were appearing for all feature reverts, and a block feature using Features Extra module was not getting properly reverted.

The following warning appeared for any feature_revert call:

Warning: Invalid argument supplied for foreach() in _features_restore() (line 936 of /home/lit/lit-test/docroot/sites/all/modules/contrib/features/features.module).

The code in the generated .install file (generated by Profiler Builder by GUI or by Drush):

  // revert features to ensure they are all installed
  $features = array(
    'lit_base',
    'lit_demo_content',
    'lit_demo_layout'
  );
  features_revert($features);

Changing the code manually to the following reduced the number of errors from three to two (and got the block actually appearing upon install!):

  // revert features to ensure they are all installed
  $features = array(
    'lit_base',
    'lit_demo_content'
  );
  features_revert($features);
  features_revert(array('lit_layout' => array('fe_block_settings')));

I finally got rid of all errors and got perfect feature reverts by using the formula

features_revert(array('module' => array('component')));

in the following code (manually replacing the generated code):

  // revert features to ensure they are all installed
  $features = array(
    array('lit_base' => TRUE),
    array('lit_demo_content' => TRUE),
  );
  features_revert($features);
  features_revert(array('lit_layout' => array('fe_block_settings')));

In the Recent log messages, the errors were replaced with the following:

features	12/26/2013 - 12:34	Revert completed for lit_layout / fe_block_settings.	Anonymous (not verified)	
features	12/26/2013 - 12:34	Reverting lit_layout / fe_block_settings.	Anonymous (not verified)	
features	12/26/2013 - 12:34	Rebuild completed for lit_demo_content / node_export...	Anonymous (not verified)	
features	12/26/2013 - 12:33	Rebuilding lit_demo_content / node_export_features.	Anonymous (not verified)	
system	12/26/2013 - 12:33	lit_demo_content module enabled.	Anonymous (not verified)	
system	12/26/2013 - 12:33	lit_demo_content module installed.	Anonymous (not verified)

The concrete issue in my actual project can be found here: https://github.com/victorkane/lit-drupal-lean/issues/8#issuecomment-3121...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

victorkane’s picture

FYI, module versions for features being used:

features: 7.x-2.0
fe_block: 7.x-1.0-beta1

(the latter from the Features Extra package).

btopro’s picture

hmm... so do you think that the features revert process has been changed? I haven't seen the notation you used above before. I'll accept a patch to modify the way it's output so that we can get the patch tested at least.

victorkane’s picture

The thing is, for many feature reverts, everything works great. But when a specific component has to be specifically specified for some reason, I saw that didn't work, and that is what motivated me (the features extra block). Don't remember where I saw the notation, but saw the errors and got the TRUE from features code. The invoked function expects a parameter, if NULL sticks in TRUE, so will test with TRUE and with NULL (more standard?).

Will whip up a patch in the next few days, thanks!

btopro’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Assigned: Unassigned » mmilutinovic1313
Priority: Normal » Minor

still noticing this issue in my travis builds of elmsln so it's still in the latest devs. minor but still annoying if you have a lot of features.

https://travis-ci.org/btopro/elmsln/jobs/39179150#L123 example of this happening on a project

eric-sf’s picture

Here's patch that changes features_revert($features) to features_revert(array('module'=>$features)) which will fix the warning.

btopro’s picture

I didn't test but will this actually perform a revert? The OP was showing

features_revert(array('module' => array('component')));

meaning like features_revert(array('views_example' => array('views'))); is at least how I interpreted what was being proposed as the solution.