When cron runs I get this error-message:

# warning: array_merge() [function.array-merge]: Argument #2 is not an array in /Users/philip/programming/drupal/sites/all/modules/contrib/feeds/includes/FeedsConfigurable.inc on line 105.
# warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /Users/philip/programming/drupal/sites/all/modules/contrib/feeds/includes/FeedsConfigurable.inc on line 107.

What could be the problem?

Files: 
CommentFileSizeAuthor
#71 array_typecast-625196-71.patch882 bytesgaspaio
#67 null_nodetype-625196-67.patch544 bytesrbrandon
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch null_nodetype-625196-67.patch.
[ View ]
#64 feeds-feeds_of_feeds-625196-64.patch1.22 KBnetw3rker
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch feeds-feeds_of_feeds-625196-64.patch.
[ View ]
#55 Untitled.png4.41 KBXiaN Vizjereij
#48 625196-48_load_source_config.patch923 bytesalex_b
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 625196-48_load_source_config.patch.
[ View ]
#44 625196-44_avoid_array_merge_warning.patch876 bytesalex_b
FAILED: [[SimpleTest]]: [MySQL] 56 pass(es), 21 fail(s), and 13 exception(es).
[ View ]
#39 feeds_625196_init-config.patch861 bytesmstrelan
FAILED: [[SimpleTest]]: [MySQL] 56 pass(es), 21 fail(s), and 13 exception(es).
[ View ]
#9 625196-9_assert_array.patch937 bytesalex_b
FAILED: [[SimpleTest]]: [MySQL] 56 pass(es), 21 fail(s), and 13 exception(es).
[ View ]
#2 debug_print_backtrace.txt15.68 KBPhil_b
#2 Bildschirmfoto 2009-11-09 um 20.45.33.png349.02 KBPhil_b

Comments

Status:Active» Postponed (maintainer needs more info)

Not sure. Could you get a debug_backtrace from when this happens?

<?php
// Add this in addConfig()
if (!is_array($config)) {
 
error_log(print_r(debug_backtrace(), true));
}
?>

I have added this but the error_log file was too big (more than 10MB !!) but I printed it to the screen and added a part of this as an attachment. I hope it helps you.
I also added a newer screenshot of the error messages

Thank you!

Does this error only occur with this feed node or with any new feed node you're creating from the same content type, too? My suspicion is that you've created this feed node, then changed the configuration, and then edited the feed node when these problems occur. (Nothing wrong with that, but this is where Feeds fails).

I´m not sure if I changed the configuration. I test it with a new installation of your module and write here what happened

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/myhot/public_html/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 105.
warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /home/myhot/public_html/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 107.

I don't understand what Feeds does. When I post a post (choose Feed content type) => there are 10 feed items show at my home page.

The above errors display when I go go Administer > Content management > Content > I selected some feed items and at "Update options" I chose "Unpublish", the errors occured when I clicked "Update" button.

I'm running into this as well... It happens with newly created feed nodes.

I've attached a compressed log file. It's pretty big, as my content type has a lot of fields.

edit: just noticed that the upload limit is only 1MB, and my compressed log file is way 6MB. PM me and perhaps I can email it to you.

I have the same problem!

I'm having the same issue. This time it happened when I imported the feed. I've attempted to import both YouTube and Flickr Feeds. and get the error for each feed item that is created.

Version:6.x-1.0-alpha7» 6.x-1.x-dev
StatusFileSize
new937 bytes
FAILED: [[SimpleTest]]: [MySQL] 56 pass(es), 21 fail(s), and 13 exception(es).
[ View ]

I still can't reproduce this error.

#2: this looks like the form element that feeds adds to the node form is completely missing. This could happen if a fetcher goes missing. Not sure how that could happen.

#5: your report points to a different problem. I've tried to followed your steps but could not reproduce.

Here is a patch that addresses the immediate symptom, the array_merge() and array_intersect_key() errors. It suppresses any operation if the passed in $config variable is not an array.

However, I am reluctant to commit this patch, because there should never be an non-array $config variable passed into addConfig(). The fact that this happens points to larger problems.

If you see these errors still happening, please respond with (zipped) debug backtraces.

Thank you.

Version:6.x-1.x-dev» 6.x-1.0-alpha10

I can get this to happen if I create a feed based on a custom node type. For some reason, creation and refresh seems to get confused and submits the feed node items into addConfig. Those nodes don't have configuration information, so passing $node->feeds for a feed item node, causes the non-array error.

Same here. I'm trying to write a custom fetcher, parser and processor as a plugin. I get these errors when I run an import.

You mention 'there should never be an non-array $config variable passed into addConfig()'. Can you please post where this config should be passed and in which method? I'm not currently using this at all.

An explanation of what addConfig is doing and why FeedsConfigurable is important / what it does would be very helpful.

Also, can public function hasSourceConfig() be overriden somewhere to switch off the requirement for config settings?

thanks,

Version:6.x-1.0-alpha10» 6.x-1.0-alpha9

Update:

I got rid of this error in my Fetcher by adding a sourceForm() function . This is then called in the fetch() function:

$source_config = $source->getConfigFor($this); (See FeedsFileFetcher.inc for an example)

Presumably because the FeedsSource interface is at the bottom of the inheritance chain, these methods are required and it will complain if they aren't there. If you look at the class declarations in the other files in /plugins, you can follow the inheritance chain to the FeedsSourceInterface and the FeedsConfigurable abstract class.

This helped me work out how it all hangs together. A diagram would be useful, as would a list of required methods.

#12:

I got rid of this error in my Fetcher by adding a sourceForm() function

Is your fetcher not inherited (directly or indirectly) from FeedsFetcher? FeedsFetcher::sourceForm() does return an empty array so it's hard to see how you fixed this problem by adding a sourceForm() method to your fetcher...

Maybe I am missing something here.

In alpha11 I get this error:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/drupal/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 104.
warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /var/www/drupal/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 106.

when I go to Administer > Content management > Content
and I choose some feeds and feed-items and do some kind of update on them.

Getting the same error. I think I have more clues. I stepped through it with xdebug and heres what I see:

Im trying to import an OPML file that creates custom nodes

line 73 of plugins/FeedsNodeProcessor.inc there is a call to node_save(); on the newly created feed importer node,

which eventually leads to the hook_nodeapi call in feeds.module.

Unfortunately lines 267-268 assume that 'validate' will always be called, and that we are always creating a feed item through a form interface.

So in the case of the node_save() mentioned above, we jump straight to the 'insert/update' portion of the code and $node_feeds is undefined when we reach line 297.

So what I cant quite figure out is what *does* need to be defined for $node_feeds at that point.. (or rather the proper way to do it such that the source configuration is set properly higher up in FeedsNodeProcessor.inc)

253   static $node_feeds;
...
260       case 'validate':
261         // On validation stage we are working with a FeedsSource object that is
262         // not tied to a nid - when creating a new node there is $node->nid at
263         // this stage.
264         $source = feeds_source($importer_id);
265
266         // Node module magically moved $form['feeds'] to $node->feeds :P
267         $node_feeds = $node->feeds;
268         $source->configFormValidate($node_feeds);
269
...
291         $last_title = NULL;
292         break;
293       case 'insert':
294       case 'update':
295         // Add configuration to feed source and save.
296         $source = feeds_source($importer_id, $node->nid);
297         $source->addConfig($node_feeds);
298         $source->save();

Title:Warning: array_merge()Warning: array_merge() & array_intersect_key()
Version:6.x-1.0-alpha9» 6.x-1.x-dev
Status:Postponed (maintainer needs more info)» Active

I am trying to import feeds and getting these errors too (using latest dev). First I see a success message like so:

    * News Feed [some feed name here] has been created.
    * Created 10 News Feed nodes.

...then I get these repeated errors (as many times as the nodes created):

# warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/mysite/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 124.
# warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /var/www/mysite/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 126.

Right after that, same repeated as many times as nodes created:

# Download of failed with code -1003.
# Download of failed with code -1003.
# Download of failed with code -1003.
...

Nodes are successfully created nevertheless. I am not trying anything custom here, simply mapping to a custom node's fields.

I can provide a log if somebody explains where the code in #1 should go (in which file I mean).

PS: this issue brings another in mind: #706536: Permission for showing failure/error + import success & deletion messages

#16 - exactly where the warning is happening.

do you mean what path?

I have enabled 'import on save', so it happens as soon as I create a new feed and save it.

I've just realized that there are no feed node items created. Feed items are created as same content type as feeds. Let me look into this...

Version:6.x-1.x-dev» 6.x-1.0-alpha14

I get basically the same warnings as #16:

[Node type] [node] was created.
Created 32 [node type] nodes.

plus 32 times

warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\xampp\htdocs\drupal\sites\mysite\modules\feeds\includes\FeedsConfigurable.inc on line 124.
warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in C:\xampp\htdocs\drupal\sites\mysite\modules\feeds\includes\FeedsConfigurable.inc on line 126.

and 32 times

File not found.

I've got a custom node type with several custom fields and a taxonomy, which I import to from an XML file by file upload using XML Parser and Feeds XML Parser.

The nodes are created alright, but still ...
Thanks for looking into it.

My issue is also caused by a custom importer...

The main difference I've noticed between my custom importer and the default 'Feed' (that seems to work fine) is that the custom importer points to the same, custom content type 'news_feed' for both the parser as well as for the processor, while the default 'Feed' importer points to 'feed_item' and 'feed' respectivelly.

Another difference is that both 'feed_item' and 'feed' content types (used by the default 'Feed' importer that comes with the module) are system content types and are disabled once I disable the default 'Feed' importer.

my custom importer export:

$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'test_feed_importer';
$feeds_importer->config = array(
  'name' => 'test_feed_importer',
  'description' => 'Test Feed Importer',
  'fetcher' => array(
    'plugin_key' => 'FeedsHTTPFetcher',
    'config' => array(
      'auto_detect_feeds' => FALSE,
      'use_pubsubhubbub' => FALSE,
      'designated_hub' => '',
    ),
  ),
  'parser' => array(
    'plugin_key' => 'FeedsSyndicationParser',
    'config' => array(),
  ),
  'processor' => array(
    'plugin_key' => 'FeedsNodeProcessor',
    'config' => array(
      'content_type' => 'news_feed',
      'update_existing' => 0,
      'expire' => '86400',
      'mappings' => array(
        '0' => array(
          'source' => 'url',
          'target' => 'url',
          'unique' => 1,
        ),
        '1' => array(
          'source' => 'description',
          'target' => 'body',
          'unique' => FALSE,
        ),
        '2' => array(
          'source' => 'guid',
          'target' => 'guid',
          'unique' => 1,
        ),
        '3' => array(
          'source' => 'timestamp',
          'target' => 'created',
          'unique' => FALSE,
        ),
        '4' => array(
          'source' => 'title',
          'target' => 'title',
          'unique' => FALSE,
        ),
      ),
    ),
  ),
  'content_type' => 'news_feed',
  'update' => 0,
  'import_period' => '3600',
  'expire_period' => 3600,
  'import_on_create' => 1,
);

I guess the only logic thing that I should try next is to create another content type 'news_feed_item' and have the processor point to it (right ?)

Confirming the same error, when "Unpromoting" a node with an FeedImporter ( Node Create + HTTP Fetcher without custom parsers .. simply fetching RSS's ) attached to it from */admin/content/node/overview

I have 2 different nodetypes with 2 different importers attached to each other. Happens whenever i "Unpromote" one or the other. However, the node is unpublished successfully.

Using 6.x-1.0-alpha14 with the ( still not commited >.< ) emfield mapper.

Importer one

$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'video_feed';
$feeds_importer->config = array(
  'name' => 'Video Feed',
  'description' => '',
  'fetcher' => array(
    'plugin_key' => 'FeedsHTTPFetcher',
    'config' => array(
      'use_pubsubhubbub' => FALSE,
      'designated_hub' => '',
    ),
  ),
  'parser' => array(
    'plugin_key' => 'FeedsSyndicationParser',
    'config' => array(),
  ),
  'processor' => array(
    'plugin_key' => 'FeedsNodeProcessor',
    'config' => array(
      'content_type' => 'feed_video_item',
      'update_existing' => 1,
      'expire' => '-1',
      'mappings' => array(
        '0' => array(
          'source' => 'title',
          'target' => 'title',
          'unique' => FALSE,
        ),
        '1' => array(
          'source' => 'description',
          'target' => 'body',
          'unique' => FALSE,
        ),
        '2' => array(
          'source' => 'url',
          'target' => 'url',
          'unique' => 1,
        ),
        '3' => array(
          'source' => 'guid',
          'target' => 'guid',
          'unique' => 1,
        ),
        '4' => array(
          'source' => 'url',
          'target' => 'field_feed_video_video',
          'unique' => FALSE,
        ),
        '5' => array(
          'source' => 'timestamp',
          'target' => 'created',
          'unique' => FALSE,
        ),
        '6' => array(
          'source' => 'tags',
          'target' => 'taxonomy:3',
          'unique' => FALSE,
        ),
      ),
    ),
  ),
  'content_type' => 'feed_video',
  'update' => 0,
  'import_period' => '1800',
  'expire_period' => 3600,
  'import_on_create' => 0,
);

Importer 2

$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'article_feed';
$feeds_importer->config = array(
  'name' => 'Article Feed',
  'description' => '',
  'fetcher' => array(
    'plugin_key' => 'FeedsHTTPFetcher',
    'config' => array(
      'auto_detect_feeds' => FALSE,
      'use_pubsubhubbub' => FALSE,
      'designated_hub' => '',
    ),
  ),
  'parser' => array(
    'plugin_key' => 'FeedsSyndicationParser',
    'config' => array(),
  ),
  'processor' => array(
    'plugin_key' => 'FeedsNodeProcessor',
    'config' => array(
      'content_type' => 'feed_article_item',
      'update_existing' => 1,
      'expire' => '-1',
      'mappings' => array(
        '0' => array(
          'source' => 'title',
          'target' => 'title',
          'unique' => FALSE,
        ),
        '1' => array(
          'source' => 'description',
          'target' => 'body',
          'unique' => FALSE,
        ),
        '2' => array(
          'source' => 'url',
          'target' => 'url',
          'unique' => 1,
        ),
        '3' => array(
          'source' => 'guid',
          'target' => 'guid',
          'unique' => 1,
        ),
        '4' => array(
          'source' => 'timestamp',
          'target' => 'created',
          'unique' => FALSE,
        ),
        '5' => array(
          'source' => 'tags',
          'target' => 'taxonomy:3',
          'unique' => FALSE,
        ),
      ),
    ),
  ),
  'content_type' => 'feed_article',
  'update' => 0,
  'import_period' => '1800',
  'expire_period' => 3600,
  'import_on_create' => 1,
);

Title:Warning: array_merge() & array_intersect_key()Add warning when using same content type for feed & feed items ...to prevernt Warning: array_merge() & array_intersect_key()
Category:bug» task

Ok, that was it... both 'Attached to:' setting in Basics settings and 'Content type:' setting in Settings for Node processor were pointing to the same custom content type 'News Feed'. I created another custom content type 'News Feed item' and pointed the Settings for Node processor to create nodes of this type.

Problem solved!

Conclusion: You should never use the same content type for both the feed (holds only the feed's URL) and feed items (the actual feed nodes). Perhaps there should be a meaningful warning if the case is such. Something like 'Same content type used for both feed and feed items! Please choose a different content type for one of them.'

... changing issue category to 'task' and updating title accordingly.

Title:Add warning when using same content type for feed & feed items ...to prevernt Warning: array_merge() & array_intersect_key()Warning: array_merge() & array_intersect_key()
Category:task» bug

I'm happy that you solved your problem, but my error occured, even when each feedimporter is attached to an individual node type and creates nodes from a different nodetype.

So ... reverting :P

Sorry about that XiaN and sorry for rushing to change things without waiting for feedback from others. I guess the excitement of solving this bug is to be blamed ;)

btw... I am using latest dev and not alpha14. Perhaps you could try that?

Absolutly no problem =)

The only difference from Alpha 14 to DEV is currently this http://drupalcode.org/viewvc/drupal/contributions/modules/feeds/feeds_de...

So i don't think that its related to that :D

On the other hand ... it should be no problem to have different Importers connected to the same node and output all the same node type. So i'm considering this as code bug :)

Just to make sure everybody gets this correct...

In my case it wasn't multiple importers pointing to the same feed item content type. It was misconfiguration and both feed (simply holding the URL of the feed) and feed item (nodes holding the imported feed content) were pointing to the same content type. So both fetcher and node processor pointed to the same content type.

In your examples in #23 XiaN, you have...

importer 1 example:
'content_type' => 'feed_video_item', + 'content_type' => 'feed_video',

importer 2 example:
'content_type' => 'feed_article_item', + 'content_type' => 'feed_article',

whereas in my case it was...

faulty importer configuration:
'content_type' => 'news_feed', + 'content_type' => 'news_feed',

corrected imported configuration (that solved the issue):
'content_type' => 'news_feed_item', + 'content_type' => 'news_feed',

In other words, you can have both 'feed_video' & 'feed_article' feeds create nodes of either 'feed_video_item' or 'feed_article_item' content types and no issue would arise. But if you changed it so that 'feed_video' feed would create nodes of content type 'feed_video' you would get the error. Same thing is you changed 'feed_article' feed to create nodes of content type 'feed_article'.

alex:

I was also getting these errors when creating/updating feed nodes and your patch in #9 fixed the problem.

None of my Feeds plugins are exposing sourceForms, so $config will always be empty when saving feed nodes. It seems others writing plugins will run into this also. In fact I'm using hook_form_alter to remove the empty fieldset displayed by Feeds. That's a separate issue though.

#29: maybe a good reason to commit #9. What's needed anyway is better error messages, but I am not sure whether we are notching closer to this goal here.

Title:Warning: array_merge() & array_intersect_key()Feeds: Warning: array_merge() & array_intersect_key()

I also received this error in Alpha 15, now reported as:

# warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/mydomain/public_html/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 124.
# warning: array_intersect_key() [function.array-intersect-key]: Argument #1 is not an array in /home/mydomain/public_html/sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 126.

These are the steps I took:

  1. Select Feed importers @ admin/feeds
  2. Click New importer, enter Name=Google feed, Description (blank), click Create.
  3. For the new Google Feed, click Edit
  4. In Basic settings: click Settings, then:
    • Attach to content type: Use standalone form
    • Minimum refresh period: 6 hours
    • Import on create = Check
  5. Set Fetcher = HTTP Fetcher
  6. Set Parser = Common syndication parser
  7. Set Processor = Node processor
  8. Click Processor Mapping, then set:
    • Source Title, Target Source, Add
    • Source Description, Target Body, Add
    • Published date, Published date, Add
    • Item URL (link), URL, Add
    • Item GUID, GUID, Add
    • Categories, Taxonomy Tags, Add
  9. Select Import, at /import and then the new "Google feed", then
    • Enter RSS feed: http://news.google.co.uk/news?pz=1&cf=all&ned=uk&hl=en&q=drupal&cf=all&output=rss
    • Click: Import

Version:6.x-1.0-alpha14» 6.x-1.0-alpha15

I should also mention that the news items appeared to import OK, at least the title and body. Not sure about the other items.

Status:Active» Needs review

#31 - great report. Thank you. I'll need to review.

The Patch provided in post #9 fixed that issue for me.

I'm using this custom module to refresh some computed fields in my content type ( that has an feed importer attached to it ) via an custom module that hooks the cron

<?php
/**
* Implementation of hook_cron().
*
* checks for differences between ldap and drupal user database.
*/
function feeds_refresh_cron() {
  // Refreshing all channel live statuses of "Feed Video" nodes
  $q="SELECT feed_nid FROM {feeds_source}";
  // Fetch a numer of nodes in the database
  $res = db_query($q);
  if (db_result($res)) {
    // Process nodes if any were found
    while ($n = db_fetch_object($res)) {
      // Load and save and count
      $node = node_load($n->feed_nid);
      $n = node_save($node);
    }
  };
}

The errors occurre, when i'm calling the cron.php from the Admin_Menu ( via the admin_menu module ).

Version:6.x-1.0-alpha15» 6.x-1.0-beta3

I am getting the following error message after every cron run.
Download of failed with code -1003.
and no warnings of array_merge() & array_intersect_key()

Don't know if it's a related issure.
The patch in #9 doesn't work for me.

Hi everybody!
Just to confirm that the klonos solution in #24 is working for me.

Version:6.x-1.0-beta3» 6.x-1.0-beta4

The error I was seeing is similar but relates to argument #1 instead which is $this->config rather than the parameter passed to the function:

array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #1 is not an array in /.../sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 124.
array_intersect_key() [<a href='function.array-intersect-key'>function.array-intersect-key</a>]: Argument #1 is not an array in /.../sites/all/modules/feeds/includes/FeedsConfigurable.inc on line 126.

- Fresh install of Feeds and Data modules
- Feed attached to "Stand alone form" with "import on create"
- Fetcher: File Upload
- Parser: CSV file
- Processor: Data processor

When trying to import from the relevant /import page, the above error messages appeared. To avoid the errors, I modified the function in includes/FeedsConfigurable.inc as follows:

<?php
 
public function addConfig($config) {
    if (
$this->config) {
     
$this->config = array_merge($this->config, $config);
    } else {
     
$this->config = $config;
    }
   
$default_keys = $this->configDefaults();
   
$this->config = array_intersect_key($this->config, $default_keys);
  }
?>

$config is an array (the function is called from feeds.pages.inc on line 80), however $this->config hadn't been initialised.

After the initial import I removed the above changes and the errors didn't return.

Needs review :)

StatusFileSize
new861 bytes
FAILED: [[SimpleTest]]: [MySQL] 56 pass(es), 21 fail(s), and 13 exception(es).
[ View ]

Patch for #37 attached.

Version:6.x-1.0-beta4» 6.x-1.0-beta6
Priority:Normal» Critical

I'm using

  public function addConfig($config) {
    if (!isset($this->config) {
      $this->config = $config;
    }
    if (is_array($config)) {
      $this->config = array_merge($this->config, $config);
      $default_keys = $this->configDefaults();
      $this->config = array_intersect_key($this->config, $default_keys);
    }
  }

now to prevent that error. Updating to critical, because it completly prevents the cron from running for me without the fix.

Edit : Got some more intel on this one

The error does not occure when feeds are refreshed via the feeds/job_scheduler cron, but when a node with an importer attached to it is loaded and saved ( node_load() + node_save() ) via custom code ( a custom module running on cron ).

What is feeds doing once you load/save a node with an importer attached to it ... firing the manual import?

Patch in #39 addressed the issue for me. I encountered the issue when uploading a CSV to create taxonomy terms.

Subscribe, getting the same errors as #31

I ran into this error too but don't understand it. I am not saving the importer node, I am simply calling feed_source()->import, yet somehow addConfig() gets called.

This has been happening on our QA servers but I have not been able to reproduce and debug on my local.

StatusFileSize
new876 bytes
FAILED: [[SimpleTest]]: [MySQL] 56 pass(es), 21 fail(s), and 13 exception(es).
[ View ]

#42: OTOH, this could happen if you aggregate feed nodes.

Attaching a variation of #39, using ternary operators and specifically checking for is_array().

I am testing this patch now, if all tests pass, I will commit.

#40: Out of curiosity, how does this warning keep your cron from executing?

andrewlevine: I put a error_log(print_r(debug_backtrace(), true)); into my addConfig() method and ran cron, updating 4 feeds but addConfig() wasn't called. If you get a chance, I'd love to see an addConfig() backtrace from your QA servers.

Status:Needs review» Fixed

This is committed now. Thank you.

http://drupal.org/cvs?commit=427372

Version:6.x-1.0-beta6» 6.x-1.0-beta8
Priority:Critical» Major
Status:Fixed» Active

The error is still there

How to reproduce?

  // Fetch all feeds
  $q= ( a query that selects all nids of all nodes with importers assigned to them )
  // Fetch a numer of nodes in the database
  $res = db_query($q);
  // Process nodes if any were found
  while ($n = db_fetch_object($res)) {
    $node = node_load($n->nid);
    node_save($node);
  };

And to ask again

The error does not occure when feeds are refreshed via the feeds/job_scheduler cron, but when a node with an importer attached to it is loaded and saved ( node_load() + node_save() ) via custom code ( a custom module running on cron ).

What is feeds doing once you load/save a node with an importer attached to it ... firing the manual import?

Status:Active» Needs review
StatusFileSize
new923 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 625196-48_load_source_config.patch.
[ View ]

#47: sorry, didn't catch your edit on #40. Here's a patch loading the source configuration on hook_nodeapi('load').

Does this fix your problems?

No, the warnings still show up :(

Status:Needs review» Needs work

Same problem. No error before very recent update. I think it's related to Feeds News.

This problem occurred for me after cloning an importer. There was no change to the initial importer but that was where the problem was happening. After reading through and making adjustments to add to content type and node processor content type the errors went away.

#49: Looks like some of your feed nodes are already damaged - ie. source configuration got overwritten with [empty] in the database. Do you experience any other problems? Look in you feeds_source.config table, I bet there are sources that don't contain a serialized array in this field - right?

No alex, every drupal_feeds_source.config field is filled with an array. But the .source is quite empty ( just 2 out of 140 have sth. there ).

I'm nearly 99% certain that feeds is doing sth. on node_save() / node_load() its not supposed to be. The cron that updates ( nodeload/save ) every node with an feed importer attached to it, takes as long as doing the feed+job scheduler cron. That should def. not be the case, if i understand feeds correctly.

StatusFileSize
new4.41 KB

Sorry for the double post, but here is an image from my last recent watchdog log .. just showing what i mean above.

On nodeload/save ( what my feeds refresh does ) each node does 2 api calls to other sites and fills some ccks in result of it. Doing these calls on an /test page with php filter tooks not longer than 200ms each. Thats why i'm suspecting feeds is doing sth. here ... and the error msg ( the array stuff ) seems to confirm me there.

Are you inserting or updating feed nodes and having 'import on submission' enabled on your importers?

The below portion of code could be cleaned up so that feeds really only imports a source on /FORM/ submission.

<?php
if ($op == 'insert' && feeds_importer($importer_id)->config['import_on_create'] && !isset($node_feeds['suppress_import'])) {
?>

It updates existing nodes and i have import on submission enabled. Sorry i did a ninja edit on my post above. Maybe thats some new information to help resolving this problem.

Version:6.x-1.0-beta8» 6.x-1.0-beta9

I don't have time this second to fully investigate, but I am not saving feed nodes. I am only saving a node type that is created by feeds.

I have found the following:
When the code enters FeedsNodeProcessor::process, $this->config['content_type'] contains the correct content type. By the time FeedsNodeProcessor::process calls node_save, $node->type is empty, which makes feeds_nodeapi enter its "if" statement because feeds_get_importer_id("") returns a totally separate standalone feed form I have.

I believe changing the line in feeds_nodeapi to

<?php
if (!empty(node->type) && ($importer_id = feeds_get_importer_id($node->type)))
?>

would fix this, but it doesn't explain why $node->type is empty going into node_save in FeedsNodeProcessor::process in the first place

I get this error, but only under certain circumstances. I am using the latest release of Drupal 6, and the latest releases of Feeds and Feeds XPath Parser.

- If I use Feeds XPath Parser to import nodes that do NOT have feed importers attached, then I get no errors.
- If I use Feeds XPath Parser to import nodes that DO have feed importers attached, then array_merge() errors on lines 127 and 129 of FeedsConfigurable.inc
- If I use Feed XPath Parser to import nodes that DO have feed importers attached AND those importers are set to import on node submission, then I also get the "Download of failed with code -1003." warnings (which makes sense, as the URL field is still blank).

I am not using any custom parsers or other custom code.

+1

Ok, after a bit of backtracing, I think I know what's causing a problem, at least in my error case. Refering back to #59, I am observing this problem when I try to use an importer to import/create nodes which themselves have a feed importer attached to them.

The error is occuring at line 372 of feeds.module, at the $source->addConfig() call in the following block of code. I think that the problem is that at this point in the creation of the new node, it doesn't yet have a feed importer attached, so even $node->feeds is returning and empty array.

      case 'insert':
      case 'update':
        // A node may not have been validated, make sure $node_feeds is present.
        if (empty($node_feeds)) {
          $node_feeds = $node->feeds;
        }
        // Add configuration to feed source and save.
        $source = feeds_source($importer_id, $node->nid);
        $source->addConfig($node_feeds);
        $source->save();

A small change to the addConfig() function in FeedsConfigurable.inc does the trick for me:

  public function addConfig($config) {
    //Adding this if statement.
    //We will set the $config field to the defaults if is empty
    if (empty($config)) {
      $config = $this->configDefaults();
    }
    $this->config = is_array($this->config) ? array_merge($this->config, $config) : $config;
    $default_keys = $this->configDefaults();
    $this->config = array_intersect_key($this->config, $default_keys);
  }

Can others let me know if that does the trick for them?

Status:Needs work» Needs review

Similar to http://drupal.org/node/973876 for D7. I think the easiest solution may be to just cast the $config argument to an array in setConfig() and addConfig() to deal with the NULL corner case, rather than adding error checking in all these node->feeds setters and so forth. See patch in comment #6 of that thread.

@david Goode: Casting the variable to an array gets rid of the error, but doesnt solve the problem. If you are importing nodes that have feeds attached to them via another feed importer, none of the config options will load for those feeds, *that* is what needs to be addressed.

@brycesenz: I'm running into the *exact* same issue as you and reading your post 2hrs ago would have saved me about 3hrs of work ;). On the plus side, while you are absolutely on the right track, I think you might not have looked far enough.

Generally speaking if you create 2 importers, one that creates nodes, and the other that attaches feeds to the nodes created by the first importer, the error in question gets thrown. This happens because the variable $node_feeds is not set during hook_nodeapi('save') due to the fact that a form was not actually submitted to render the node. This was brought up in comment #15, but seems to have been ruled out at the time. The error then happens because during node_save, the now empty $node_feeds array gets sent to:

        $source->addConfig($node_feeds);

the solution that gets this working for me is to add code to hook_nodeapi('prepare') that puts keys in node that are exactly like the ones provided by feeds_form_alter(). once that happens, the nodeapi('save') hook has the data in $node that it needs to properly populate the config options for the feed being attached to it. here's the code:

<?php
function feeds_nodeapi(&$node, $op, $form) {
 
// $node looses any changes after 'validate' stage (see node_form_validate()).
  // Keep a copy of title and feeds array between 'validate' and subsequent
  // stages. This allows for automatically populating the title of the node form
  // and modifying the $form['feeds'] array on node validation just like on the
  // standalone form.
 
static $last_title;
  static
$node_feeds;
 
// Break out node processor related nodeapi functionality.
 
_feeds_nodeapi_node_processor($node, $op);
  if (
$importer_id = feeds_get_importer_id($node->type)) {
    switch (
$op) {
     
// prepare the node with the right keys to allow new feed nodes to be created
     
case 'prepare':
       
$source = feeds_source($importer_id, empty($node->nid) ? 0 : $node->nid);
       
$node->feeds=array();
       
$node->feeds += $source->configDefaults();
      break;
      case
'validate':
...
?>

I'll post a patch for this at some point in the next day or so. Hope this helps someone!

StatusFileSize
new1.22 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch feeds-feeds_of_feeds-625196-64.patch.
[ View ]

as promised, here's the patch.

I tried the patch but still same problem

subscribing

StatusFileSize
new544 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch null_nodetype-625196-67.patch.
[ View ]

The patch by "netw3rker" above fixes 90% of the issue, zazinteractive may be having the same issue I was. There are some cases when $node->type is null and since the 'opml' importer does not have a content type defined it matches this case and calls add config with the null value.

The solution is to check to make sure that the node type is set before calling feeds_get_importer_id

Patch is attached.

- Richard

I'm running into this problem on Drupal 7. Is there a D7 solution?

Status:Needs review» Needs work

The last submitted patch, null_nodetype-625196-67.patch, failed testing.

I also wanted to add (using 6.x-1.0-beta10) that the klonos solution in #24 is also working for me.

Version:6.x-1.0-beta9» 6.x-1.x-dev
StatusFileSize
new882 bytes

I had this problem too when the sourceForm was empty, i.e., no options ware configured by the fetcher, parser or processor. I build some custom feeds components that needed no source options.
Much like #9, i do a simple typecast and it works.

Title:Feeds: Warning: array_merge() & array_intersect_key()Fatal errors (Unsupported operand types) and warnings (Argument is not an array) in FeedsConfigurable

Version:6.x-1.x-dev» 7.x-2.x-dev

I'm getting a similar error in d7, when programatically creating nodes that chain new nodes, using a custom function with the Clone Autocreate module. Basically, I'm implementing hook_field_storage_pre_insert() to clone a node and save its nid as a noderefernce field. This works, until I clone a node of a type that clones another node. Note that in no case are any of the types Feed or Feed content types. Sorry it's so twisty in there...

Fatal error: Unsupported operand types in /var/www/staging/sites/all/modules/contrib/feeds/includes/FeedsConfigurable.inc on line 150.

Version:7.x-2.x-dev» 6.x-1.x-dev

never mind; was my bad. setting back to d6.

Yes, #24 fixed my problem as well! I'm using Feeds 7. I wish there had been a warning as you suggested since this problem was not documented and I spent a day tracking it down. Thank you for your comment!

#48 works, but $node->feeds, not node->feed

  case 'load':
    $node->feeds = feeds_source($importer_id, $node->nid)->config;
    break;