The following notice and warning appear on first visit to the configuration settings page:
Notice: Undefined index: configuration_dependency in configuration_download_config() (line 825 of sites/all/modules/configuration/configuration.admin.inc).
Warning: Invalid argument supplied for foreach() in configuration_download_config() (line 825 of sites/all/modules/configuration/configuration.admin.inc).

I suspect checking to be sure that $export is an array, and that the appropriate keys are set would be good, before attempting the foreach there.

Comments

btmash’s picture

Project: Configuration » Configuration Management
Version: » 7.x-1.x-dev

Moving to appropriate project.

lucascaro’s picture

This also appears after exporting configuration. Same error, same file and line.
It is related to this code:

if ($configs) {
    foreach($export['configuration_dependency']['configuration'] as $component => $config) {
      foreach($config as $name => $parent) {
        $c[$component][$name]['status'] = CONFIGURATION_DATASTORE_ONLY;
        $c[$component][$name]['parent'] = $parent;
      }
    }
    configuration_write_export_file($c, "temporary://config.export");
  }

The problem here is that configuration_dependency does not exist in this array. Here's an example value I got exporting input formats:

array(3) (
  [configuration] => array(1) (
    [filter] => array(3) (
      [filtered_html] => (string) filtered_html
      [full_html] => (string) full_html
      [plain_text] => (string) plain_text
    )
  )
  [dependencies] => array(2) (
    [configuration] => (string) configuration
    [filter] => (string) filter
  )
  [conflicts] => array(0)
)

Should $export['configuration_dependency']['configuration'] be instead $export['configuration']['dependencies'] ?

lucascaro’s picture

Priority: Normal » Major

Bumping to major since this is blocking the export functionality.

lucascaro’s picture

Also if that's the case, there are several places using $export['configuration_dependency'] that might be breaking the functionality, like function _configuration_track_dependencies($export) at configuration.export.inc:779

lucascaro’s picture

Here's a patch for this punctual issue, changing the key to dependencies.

I'm not sure why in different places configuration_dependency and dependencies are used, but in this case it was dependencies, so this is fixed.

Need to keep an eye out for other problems with this array key.

dragonwize’s picture

Status: Active » Needs review
GDrupal’s picture

Status: Needs review » Needs work

A strange thing is happening to me and right now (i'm testing configuration against open publish distribution) this patch does not work in my environment. I'm afraid that there is a lack o consistency in the definition of the $export array structure and we need to track it down.
This how my "$export" array looks right now for me:


array(3) {
  'configuration' => array(1) {
    'views_view' => array(6) {
      'archive' => string(7) "archive" 'backlinks' => string(9) "backlinks" 'frontpage' => string(9) "frontpage" 'glossary' => string(8) "glossary" 'openpublish_related_content' => string(27) "openpublish_related_content" 'taxonomy_term' => string(13) "taxonomy_term"
    }
  } 'dependencies' => array(6) {
    'ctools' => string(6) "ctools" 'node' => string(4) "node" 'openpublish_related_content' => string(27) "openpublish_related_content" 'search' => string(6) "search" 'taxonomy' => string(8) "taxonomy" 'views' => string(5) "views"
  } 'conflicts' => array(0) {
    
  }
}

Seems that 'configuration" and 'dependencies' are at the same level so... looks that we have to use only 'dependencies'. But i'm not sure at all if the array structure will change in other contexts. :x

lucascaro’s picture

Thanks for the review @GDrupal, I suspect that the configuration key is something else and as we talked on skype, this problem seems to be deeper than we thought.

Lets ignore this patch and I'll add some test cases to the module and try to illustrate the different cases.

GDrupal’s picture

Yeap! I totally agreed test cases will help us to understand better what is happening behind the curtains.

dagmar’s picture

I think this is a duplicated of #1698428: Several Notice messages on configuration migrate page.

As far I know, the patch from #5 is not correct. $export['configuration_dependency']['configuration'] shouldn't be replaced by $export['configuration_dependency']['configuration'] because there are different things.

After some research I found that $export['configuration_dependency'] have values when taxonomies are exported, this came from taxonomy_configuration_export().

So, I think we just check if there is values for $export['configuration_dependency'] using a !empty like I already did in #1698428: Several Notice messages on configuration migrate page.

What do you think?

lucascaro’s picture

@dagmar I think you got it right.

lucascaro’s picture

Status: Needs work » Closed (duplicate)