* warning: Invalid argument supplied for foreach() in C:\wamp\www\druptest\modules\node\node.module on line 561.
* warning: implode() [function.implode]: Invalid arguments passed in C:\wamp\www\druptest\modules\node\node.module on line 565.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in C:\wamp\www\druptest\includes\database.mysql.inc on line 174.
Working with
Node Hierarchy (5.x-1.x-dev and production)
Automatic Nodetitles (5.x-1.x-dev and production)
Drupal 5.11 (Have seen same error on 5.7 and 5.9)
Getting this error on a production install so did some trial and error on a fresh Drupal 5.11 install turning modules on and off until I narrowed it down to Hierarchy. I then made another fresh default install and installed only the modules listed above
I setup "Automatically generate the title and hide the title field" and Pattern for title to [mon][author-name] on the default Page Content Type.
And the error appears
If I set Story as a parent and Page as a child the error will go away.
Without a Hierarchy, Error appears the first time content is created and every time content is opened for editing/saved.
Anyone have any thoughts?
Comments
Comment #1
hopla commentedI get the same error on node submit, in combination with CCK filefield and filefield_paths. I know filefield and/or filefield_paths must have something to do with it, because: when I submit a node without a filefield, everthing works fine. Also, when I submit a node with a filefield, but don't actually upload a file (leave filefield empty), everything works fine.
The warning originates in nodehierarchy_token.inc on line 22 ("if ($parent = node_load($node->parent)) {") :
$node->parent is probably NULL and thus, the node_load function generates a warning.
Funny thing is, while these functions are called for both admins and normal users, the warning is only displayed for normal users! Even though when admin, $node->parent is also NULL !
I suggest a check to see if $node->parent is null before calling node_load. But I don't know if that's just fixing the symptom and not the real problem... See, I'm not sure why nodehierarchy_token_values is called on a content type that isn't set up as parent, nor as child...
Comment #2
hopla commentedOk, I just got thinking: calling this function is normal, and is used by another module (like filefield_paths) to get all possible replacement tokens from this module (and likely does it for all other modules as well). Weather or not it actually uses them.
So I think that, the fact that $node->parent can be NULL at this point was just not expected by the programmer. Since, perhaps, he only expected this function to be called in a nodehierarchy context?
So the best solution would, indeed, be to check if $node->parent is NULL, before calling node_load?
Is my reasoning correct?
Comment #3
rssaddict commentedI have the same error with Automatic Nodetitle but without Node Hierarchy installed.
Comment #4
hopla commentedThat could very well be. It's very likely that other module developers also call node_load without checking if it's first parameter is not null.
You could say the problem lays with node_load and that IT should check if it's first parameter is null or not. Someone seems to have suggest just that: http://drupal.org/node/102030 . But since there hasn't been any reaction on that issue report since December 30, 2006, I guess that Drupal core developers expect the module developers to check the params they give to node_load...
Which brings us back to my question:
Comment #5
ronan commentedI ran across that one myself recently. I'll get it patched as soon as I can.
R
Comment #6
hopla commentedThanks Ronan! I can submit a patch for it, but it's so trivial, I think it would only waste your time :)
Comment #7
ronan commentedOk, should be good in the latest 5.x-1.x-dev. Thanks for all your patience.