Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#71 | array_typecast-625196-71.patch | 882 bytes | gaspaio |
#67 | null_nodetype-625196-67.patch | 544 bytes | rbrandon |
#64 | feeds-feeds_of_feeds-625196-64.patch | 1.22 KB | netw3rker |
#55 | Untitled.png | 4.41 KB | XiaN Vizjereij |
#48 | 625196-48_load_source_config.patch | 923 bytes | alex_b |
Comments
Comment #1
alex_b CreditAttribution: alex_b commentedNot sure. Could you get a debug_backtrace from when this happens?
Comment #2
Phil_bI 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
Comment #3
alex_b CreditAttribution: alex_b commentedThank 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).
Comment #4
Phil_bI´m not sure if I changed the configuration. I test it with a new installation of your module and write here what happened
Comment #5
superthin CreditAttribution: superthin commentedI 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.
Comment #6
stockliasteroid CreditAttribution: stockliasteroid commentedI'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.
Comment #7
WoozyDuck CreditAttribution: WoozyDuck commentedI have the same problem!
Comment #8
ccoppen CreditAttribution: ccoppen commentedI'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.
Comment #9
alex_b CreditAttribution: alex_b commentedI 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.
Comment #10
mweixel CreditAttribution: mweixel commentedI 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.
Comment #11
CODECOWBOY-1 CreditAttribution: CODECOWBOY-1 commentedSame 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,
Comment #12
CODECOWBOY-1 CreditAttribution: CODECOWBOY-1 commentedUpdate:
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.
Comment #13
alex_b CreditAttribution: alex_b commented#12:
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.
Comment #14
lennart CreditAttribution: lennart commentedIn 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.
Comment #15
MixologicGetting 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)
Comment #16
klonosI am trying to import feeds and getting these errors too (using latest dev). First I see a success message like so:
...then I get these repeated errors (as many times as the nodes created):
Right after that, same repeated as many times as nodes created:
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
Comment #17
alex_b CreditAttribution: alex_b commented#16 - exactly where the warning is happening.
Comment #18
klonosdo you mean what path?
I have enabled 'import on save', so it happens as soon as I create a new feed and save it.
Comment #19
klonosI'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...
Comment #20
kissmedve CreditAttribution: kissmedve commentedI 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.
Comment #21
klonosMy 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:
Comment #22
klonosI 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 ?)
Comment #23
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedConfirming 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
Importer 2
Comment #24
klonosOk, 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.
Comment #25
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedI'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
Comment #26
klonosSorry 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?
Comment #27
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedAbsolutly 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 :)
Comment #28
klonosJust 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'.
Comment #29
milesw CreditAttribution: milesw commentedalex:
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.
Comment #30
alex_b CreditAttribution: alex_b commented#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.
Comment #31
iantresman CreditAttribution: iantresman commentedI also received this error in Alpha 15, now reported as:
These are the steps I took:
admin/feeds
/import
and then the new "Google feed", thenhttp://news.google.co.uk/news?pz=1&cf=all&ned=uk&hl=en&q=drupal&cf=all&output=rss
Comment #32
iantresman CreditAttribution: iantresman commentedI should also mention that the news items appeared to import OK, at least the title and body. Not sure about the other items.
Comment #33
alex_b CreditAttribution: alex_b commented#31 - great report. Thank you. I'll need to review.
Comment #34
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedThe 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
The errors occurre, when i'm calling the cron.php from the Admin_Menu ( via the admin_menu module ).
Comment #35
meatbag CreditAttribution: meatbag commentedI 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.
Comment #36
avantwaves CreditAttribution: avantwaves commentedHi everybody!
Just to confirm that the klonos solution in #24 is working for me.
Comment #37
imclean CreditAttribution: imclean commentedThe error I was seeing is similar but relates to argument #1 instead which is
$this->config
rather than the parameter passed to the function:- 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:
$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.
Comment #38
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedNeeds review :)
Comment #39
mstrelan CreditAttribution: mstrelan commentedPatch for #37 attached.
Comment #40
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedI'm using
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?
Comment #41
jrbeemanPatch in #39 addressed the issue for me. I encountered the issue when uploading a CSV to create taxonomy terms.
Comment #42
pcambraSubscribe, getting the same errors as #31
Comment #43
andrewlevine CreditAttribution: andrewlevine commentedI 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.
Comment #44
alex_b CreditAttribution: alex_b commented#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?
Comment #45
alex_b CreditAttribution: alex_b commentedandrewlevine: 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.Comment #46
alex_b CreditAttribution: alex_b commentedThis is committed now. Thank you.
http://drupal.org/cvs?commit=427372
Comment #47
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedThe error is still there
How to reproduce?
And to ask again
Comment #48
alex_b CreditAttribution: alex_b commented#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?
Comment #49
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedNo, the warnings still show up :(
Comment #50
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedComment #51
MissyM CreditAttribution: MissyM commentedSame problem. No error before very recent update. I think it's related to Feeds News.
Comment #52
jusyjim CreditAttribution: jusyjim commentedThis 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.
Comment #53
alex_b CreditAttribution: alex_b commented#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?
Comment #54
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedNo 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.
Comment #55
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedSorry 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.
Comment #56
alex_b CreditAttribution: alex_b commentedAre 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.
Comment #57
XiaN Vizjereij CreditAttribution: XiaN Vizjereij commentedIt 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.
Comment #58
andrewlevine CreditAttribution: andrewlevine commentedI 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
would fix this, but it doesn't explain why $node->type is empty going into node_save in FeedsNodeProcessor::process in the first place
Comment #59
brycesenz CreditAttribution: brycesenz commentedI 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.
Comment #60
halver CreditAttribution: halver commented+1
Comment #61
brycesenz CreditAttribution: brycesenz commentedOk, 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.
A small change to the addConfig() function in FeedsConfigurable.inc does the trick for me:
Can others let me know if that does the trick for them?
Comment #62
David Goode CreditAttribution: David Goode commentedSimilar 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.
Comment #63
netw3rker CreditAttribution: netw3rker commented@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:
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:
I'll post a patch for this at some point in the next day or so. Hope this helps someone!
Comment #64
netw3rker CreditAttribution: netw3rker commentedas promised, here's the patch.
Comment #65
zazinteractive CreditAttribution: zazinteractive commentedI tried the patch but still same problem
Comment #66
rich.yumul CreditAttribution: rich.yumul commentedsubscribing
Comment #67
rbrandon CreditAttribution: rbrandon commentedThe 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
Comment #68
paulgemini CreditAttribution: paulgemini commentedI'm running into this problem on Drupal 7. Is there a D7 solution?
Comment #70
databoy CreditAttribution: databoy commentedI also wanted to add (using 6.x-1.0-beta10) that the klonos solution in #24 is also working for me.
Comment #71
gaspaio CreditAttribution: gaspaio commentedI 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.
Comment #72
Dave ReidMarked #973876: NULL $config causing "Unsupported operand..." and #1125060: Import Problems as duplicates of this issue.
Comment #73
aaron CreditAttribution: aaron commentedI'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.
Comment #74
aaron CreditAttribution: aaron commentednever mind; was my bad. setting back to d6.
Comment #75
hwasem CreditAttribution: hwasem commentedYes, #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!
Comment #76
nadu CreditAttribution: nadu commented#48 works, but $node->feeds, not node->feed
Comment #77
MegaChriz CreditAttribution: MegaChriz at WebCoo commented#1213472: " Fatal error: Unsupported operand types in /FeedsConfigurable.inc" when importing