Invalid argument supplied for foreach() in /home/checkout/drupal-6.19/sites/all/modules/features/features.module on line 272.
Invalid argument supplied for foreach() in /home/checkout/drupal-6.19/sites/all/modules/features/features.module on line 386.
Invalid argument supplied for foreach() in /home/checkout/drupal-6.19/sites/all/modules/features/features.export.inc on line 310.

I've added some checks on those lines (if(is_array... ) but i'm not sure that is the correct fix. this happens after calling module_invoke and module_implements (which is supposed to return an array) ..

After adding the ifs, I got:
Invalid argument supplied for foreach() in /home/checkout/drupal-6.19/sites/all/modules/features/features.module on line 390.
Same problem there.

After adding another if, there were no more warnings.

CommentFileSizeAuthor
#5 features-890412.patch919 bytesdagmar

Comments

yhahn’s picture

Status: Active » Postponed (maintainer needs more info)

All of these warnings look like a case of a badly declare hook_features_api() somewhere in your codebase. Do you want to do some debugging and track down where that declaration is?

lucascaro’s picture

sure, I'll report back here.

that0n3guy’s picture

I get these errors when using this patch: https://drupal.org/node/624018#comment-3270940 with wysiwyg untill I enable exportables... then they go away.

dagmar’s picture

Status: Postponed (maintainer needs more info) » Active

I'm seeing the same issue:

It seems to be related to this commit: http://drupal.org/node/884624#comment-3349396

-    $export_key = $schema['export']['key'];
-    // If a list callback is available use it, otherwise fallback to generating
-    // options from ctools_export_load_object().
-    if (function_exists($schema['export']['list callback'])) {
-      $objects = $schema['export']['list callback']();
-      $options = drupal_map_assoc(array_keys($objects));
+    if (!empty($schema['export']['list callback']) && function_exists($schema['export']['list callback'])) {
+      $options = $schema['export']['list callback']();
     }
-    else if ($objects = ctools_export_load_object($component, 'all')) {
-      $options = drupal_map_assoc(array_keys($objects));
+    else {
+      $options = _ctools_features_export_default_list($component, $schema);

Before this commit, list_callback function should return a list of objects. After the commit, list_callback have to return an array.

I'm using the 'old' method in Input Formats module and in the Wysiwyg Ctools patch. My question is: we have to modify Features module? or I have to modify input formats module and the wysiwyg patch?

dagmar’s picture

Status: Active » Needs review
StatusFileSize
new919 bytes

IMO this patch will be enough and is compatible with both kinds of list_callbacks returns, objects and keys.

yhahn’s picture

Status: Needs review » Needs work

@dagmar: Nope, the list callback should provide an array of machine_name => human readable for each exportable object. The patch uses array_keys() which basically throws out the human readable names -- not good.

My suggestion is to make a fix upstream to your list callback in Input Formats.

dagmar’s picture

Title: Invalid argument supplied for foreach() » Invalid argument supplied for foreach() in feature module
Project: Features » Input Formats
Version: 6.x-1.0-rc3 » 6.x-1.0-beta5
Status: Needs work » Fixed

So, assuming input formats is the raise of this issue. I have committed a patch to fix the problem. http://drupal.org/cvs?commit=414114

Please re-open if this issue persist.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.