Forum error: Invalid argument supplied for foreach() in node.module on line 521
Shortly after applying the Drupal 5.2 patch to my site, I noticed that whenever I go to a forum, I get errors. I just updated the site to Drupal 5.5, and still get the same errors: * warning: Invalid argument supplied for foreach() in /modules/node/node.module on line 521. * warning: implode(): Bad arguments. in /modules/node/node.module on line 525. * 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 /includes/database.mysql.inc on line 172. Forum module 5.5 OG Forum module: 5.x-2.x-dev I can't seem to find any posts on this particular issue. I looked at these two: http://drupal.org/node/164499 http://drupal.org/node/180529 But, they don't seem to relate to me as I don't have the book, subscriptions or privatemsg modules installed. I get the error every time I click on a forum, and it appears at no other time. The only exception is when I click on a forum created by OG Forum. Do not receive any errors on OG Forums. Does anyone have any idea why this is happening? Thanks for any suggestions. -ron -- Ron Parker Software Creations http://www.scbbs.com Self-Administration Web Site http://saw.scbbs.com SDSS Subscription Mgmt Service http://sdss.scbbs.com Central Ave Dance Ensemble http://www.centralavedance.com R & B Salsa http://www.randbsalsa.com
Ron Parker wrote:
* warning: Invalid argument supplied for foreach() in /modules/node/node.module on line 521.
This is almost always a case of node_load being called without a node id. andre
Thanks. What can I do about it? -ron Andre Molnar wrote:
Ron Parker wrote:
* warning: Invalid argument supplied for foreach() in /modules/node/node.module on line 521.
This is almost always a case of node_load being called without a node id.
andre
__________ NOD32 2716 (20071211) Information __________
This message was checked by NOD32 antivirus system. http://www.eset.com
-- Ron Parker Software Creations http://www.scbbs.com Self-Administration Web Site http://saw.scbbs.com SDSS Subscription Mgmt Service http://sdss.scbbs.com Central Ave Dance Ensemble http://www.centralavedance.com R & B Salsa http://www.randbsalsa.com
Ron Parker wrote:
Thanks. What can I do about it?
Well I think it goes without saying that you have to find all the calls to node_load in your theme or custom modules and make sure they have a nid - or at least make sure that nid is tested before making a call to node load. andre
Andre Molnar wrote:
Well I think it goes without saying that you have to find all the calls to node_load in your theme or custom modules and make sure they have a nid - or at least make sure that nid is tested before making a call to node load.
andre
Thank you. This collective information lead me to look where I had not thought to look: my own custom module. There I found the solution. It was as you said: The code was calling node_load on an nid that didn't exist. Thanks to all who helped. -ron -- Ron Parker Software Creations http://www.scbbs.com Self-Administration Web Site http://saw.scbbs.com SDSS Subscription Mgmt Service http://sdss.scbbs.com Central Ave Dance Ensemble http://www.centralavedance.com R & B Salsa http://www.randbsalsa.com
* warning: Invalid argument supplied for foreach() in /modules/node/node.module on line 521.
This is almost always a case of node_load being called without a node id.
Right, more precisely, the nid is coming from a db query which comes back empty handed thus the fetch will be FALSE and then node_load fails with this error.
participants (3)
-
Andre Molnar -
Karoly Negyesi -
Ron Parker