Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.x-dev
Component:
content.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2008 at 14:06 UTC
Updated:
19 Jun 2010 at 00:12 UTC
Jump to comment: Most recent file
Comments
Comment #1
karens commentedThe current code is not invoking nodeapi if there are no fields, so this shouldn't be needed, I wonder where this is coming from if not from nodeapi? Where are you seeing it?
Comment #2
agentrickardOn the default home page. I just cleared all content and reloaded with Devel Generate and removed a bunch of modules. Same error, even when only running Content module.
Comment #3
karens commentedWeird, I don't see that at all. I guess there's no harm in adding that in, though, even if I can't replicate the problem.
Comment #4
agentrickardSeems to be happening in $op = 'preprocess_node'.
For some reason, I am getting an empty node passed to content_nodeapi(), but I can't tell why.
Looks like I will need to rebuild my D6 test site and try to replicate.
Comment #5
agentrickardThis was some kind of bug in my testing environment. Cannot replicate on a fresh install.
Comment #6
spiffyd commentedI can replicate this bug - I get it (among other errors) when I preview comments.
Here are all the errors:
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/content_permissions/content_permissions.module on line 21.
warning: Invalid argument supplied for foreach() in /sites/all/modules/fileframework/contrib/cck/file_cck.module on line 56.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 556.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 570.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 556.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 570.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 556.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 570.
warning: Invalid argument supplied for foreach() in /sites/all/modules/cck/content.module on line 1213.
Comment #7
yched commentedspiffyd : most likely something's wrong on your setup. The type of your node does not appear in the list of available node types, as collected by node_get_types().
Comment #8
spiffyd commentedI'm not really sure what can be wrong because everything has been working flawlessly on my set up so far other than this warning.
I was previewing comments on a "Blog entry" content type which consists of the following fields:
DEFAULT FIELDS
Title
Body
Taxonomy
File attachments
Menu settings
ADDED BY ME
Node Reference (CCK mod)
Link (Links mod)
File (File Framework mod)
I have a feeling that the errors are due to the fact that there is no inputted content for some of these fields (NULL) - in this case, there's nothing for Node Reference, Link, and File, and File attachments.
What do you think?
Comment #9
spiffyd commentedComment #10
yched commentedHm. Could you try disabling Links and File Framework and see if you still get the warnings ?
(Be sure you backup your db before you do those tests)
Comment #11
gribnif commentedIn my case, I'm seeing this error because I have some code that is calling theme() to display a custom error message:
I can avoid the error in my code by just adding: $node->type = 'story' (which I probably should do, anyway.) It might be better, however, to avoid the error in CCK, so the problem goes away for everyone. Just change the "else" at line 1212 of content.module from:
to:
Comment #12
yched commented@Gribnif : "It might be better, however, to avoid the error in CCK, so the problem goes away for everyone"
Would be easier, but that's precisely what we've been trying to avoid, since this is not *supposed* to happen, so those errors are the sign that something is wrong, and it's best to know it rather than hide it under the carpet.
In your case, precisely, yes, a $node without a $node->type is definitely a problem, and it's best to get the errors :-)
Comment #13
NewZeal commentedI'm having the same error calling a webform from a script using this:
The webform does have custom fields.
Added patch, error gone and form looking OK.
Comment #14
yched commentedSo far we intentionally left the code unshielded, precisely because it detects that some code somewhere (either in core or in 3rd party contrib) is doing something wrong. However, while CCK is not the source of the bug, those issues end up polluting the our issue queue, generating threads that quickly become flooded with unrelated 'me too's because such problems can come from many different sources. Enough with this.
I added code in the few places I could spot that could get broken to babysit invalid incoming data.
Comment #15
agentrickardYou have my sympathies.
Comment #16
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #17
gerhard killesreiter commentedSorry to re-open this, but the bug seems still to be there.
I am using CCK 6.x-2.2.
I am getting the error message Invalid argument supplied for foreach() in /home/web/html/sites/all/modules/cck/modules/fieldgroup/fieldgroup.module on line 560 during re-indexing for the search using xapian.
Xapian does:
$node = node_load($node->nid, NULL, TRUE);
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);
Anything wrong about this?
Comment #18
yched commented@Gerhard:
- is it guaranteed that the nid exists (meaning : $node is not NULL)
- I think there should be a $node->build_mode set before calling node_build_content, not sure that would cause the warnings
Comment #19
markus_petrux commentedLine 560 in fieldgroup.module looks like this:
And here $group['fields'] should be an array, even if the group has no fields. So it seems there's something odd in the fieldgroup data table for the affected field group. Maybe it's just the cached version of the data so maybe clearing content cache helps.
Comment #20
gerhard killesreiter commented- I think there should be a $node->build_mode set before calling node_build_content, not sure that would cause the warnings
No, node_build_content does this already if it is not set. I'll investigate more tomorrow.
Comment #21
gerhard killesreiter commentedOk, the problem was that some of my coworkers had managed to create nodes without $node->type.
Comment #23
marcvangendI had the same error. The cause turned out to be a non-existing uid in a couple of rows in the node table. I have no clue how that happened, but at least it was easy enough to fix in phpmyadmin. I hope that helps anyone with similar errors.
Comment #24
kardave commentedHi, (please be patient, my english is bad)
I have (had) the same problem. I use CCK 6.x-2.2.
I have a job node type, with several vocabulary. The error shown up on term pages, like 'taxonomy/term/1'.
The error was:
Invalid argument supplied for foreach() in \sites\all\modules\cck\content.module on line 1278.It was repeated several times above the node teasers.
I used devel module to delete all content and generate new ones, but the error stayed, and its nature. I mean on the 'taxonomy/term/1' page there were always 3 errors above the teasers. Another term page always had 5 error messages, and some other term pages never had error.
I use the modul Advanced Taxonomy Blocks. It displays a number after each term, representing the number of nodes belonging to it.
I noticed that this number is always equals to the number of the errors plus the number of listed nodes.
So the error should mean missing or defected nodes.
I deleted all nodes at 'admin/content/node', but the error was still there.
Finaly I got to the old PhpMyadmin, and emptied all tables which had a nid filed, except node_type.
The errors disappeared.
So I can say this error is not CKK related, although it seems to be. Maybe it is Drupal core. I don't know.
Somehow some data (probably at term_data) is not erased at normal or devel modules' node deletion.
I use the following modules:
Sorry for being long. I hope this note helps catching the errors source. I also had the errors when i was logged in with another user (not user#1).
Thanks,
David
Comment #25
anton.safin commentedI have the same warning:
Invalid argument supplied for foreach() in \sites\all\modules\cck\content.module on line 1278., when i forget addreturn $node;in my own module's implementation of hook_view().Comment #26
jrabe commentedHad the same problem, warning ... foreach etc. in content.module, and a node on front page with "n/a" as content. Used phpmyadmin to find a node in node table that had an invalid uid. Edited to have a valid uid and problem gone. The node in question was a valid node, which now shows up on home page as desired with all its content intact.
I believe the problem started when I did an upgrade from 6.13 to 6.14. I am a complete newbie and didn't disable all my modules before doing the upgrade. Won't happen again. It's been a saga finding this one tidbit that helped fix it.
Thank you, thank you.
Comment #27
glass.dimly commentedFor me, this was a user I had deleted from the database. All the pages that user had created returned "page not found" and the blog page (he was a blogger) displayed this error.
I located his user id by poking around in the database, then, in PHPmyadmin's SQL window, ran
update node set uid = replace(uid,'old_id','new_id');Comment #28
mihi commentedI meet this problem also!
but now it is not display.
because i uninstall the module of fileframewor .
so I think it is a conflict between filefield and filenode!
Comment #29
scoobie commentedI just installed a clean version of Drupal, Views 2.11, cck 2.7, nodecomment 2.0beta5, Author Pane 2.0 alpha2, and Advanced Forum 6.20 alpha2.
Created 1 content type - Forum Reply.
When clicking on New Topic, I immediately get the error "cck\content.module on line 1284". Doing a google on that resulted in hundreds of sites.
I strongly suspect its in the nodecomment configuration.
Any ideas?
*edit*
Repeated above with exception of nodecomment. After testing to make sure forums worked as expected, installed nodecomment. This issue did not reoccur, though there where other unrelated issues.
I have not attempted to create a new content type based on the nodecomment.