I have often received the php errors like this, I don't know if it is a bug or setting error.

also I found that when you visit http://www.eefan.net/book/export/html/misc/print.css in the browser and then visit the frontpage http://www.eefan.net/ and these errors come up.

Location http://www.eefan.net/book/export/html/misc/print.css 

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 /domains/eefan.net/public_html/includes/database.mysql.inc on line 172 

Invalid argument supplied for foreach() in /domains/eefan.net/public_html/modules/node/node.module on line 521

implode() [<a href='function.implode'>function.implode</a>]: Bad arguments. in /domains/eefan.net/public_html/modules/node/node.module on line 525 

Comments

coldfly’s picture

Is there anyone who has the same error with me?

nwe_44’s picture

will let you know if I find anything in my bug checking.

coldfly’s picture

here are the modules which i use in the site, they are all official release, i hope it can help
auditfiles
blogger
buddylist
google_analytics
gsitemap
image
invite
og
panels
pathauto
poormanscron
privatemsg
tinymce
views

coldfly’s picture

my server info
Apache 2.2.4
MySQL 5.0.41

LUTi’s picture

I've noticed the same error today.

In fact, there were 3 separate errors logged, which are related to a
/book/export/html/misc/print.css
display (as above, just different order):

1.
Invalid argument supplied for foreach() in /modules/node/node.module on line 521.

2.
implode() [function.implode]: Bad arguments. in /modules/node/node.module on line 525.

3.
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.

(I've skipped the site / file location part...)

I am sure it is introduced with 5.2 version of Drupal, as I didn't notice such errors with 5.1 before.

LUTi’s picture

I believe the problem is that some other (past) version improperly used /misc/print.css address as above. Now in 5.2, since there is nothing at this address, those errors came up (if someone / something uses the old URL; the new printer friendly page display of a book does not generate those errors, so I presume a css is fetched from some other - probably the right one - address).

I believe I've resolved the problem creating a 301 redirect from /book/export/html/misc/print.css to /misc/print.css (using a great Path Redirect module, which I find extremely useful to resolv the obsolete URLs problems).

SomebodySysop’s picture

I'm getting the same errors, only when I click on any forum (except OG created forums). No other place. I do not have the book module installed. I don't know what I should create a redirect from in order to use your resolution. The only content type that appears to be affected are forum topics. Any ideas what I should do?

Mark Theunissen’s picture

Hi SombodySysop,

I'm also getting these errors on forums... did you solve the problem?

Regards,
capdog

SomebodySysop’s picture

Need help!

I just updated my site to 5.5 and the errors still occur. The only thing I know for sure is that the error does NOT occur with forums created by og_forum. Help!

zenoyu’s picture

Just a quick dirty fix:

Open the /modules/node/node.module, goto line# 521

//* Line#521, insert below four lines:
$cond = array();
if( $param==null || !is_array($param) ){
return null;
}
// */
foreach ($param as $key => $value) {
$cond[] = 'n.'. db_escape_string($key) ." = '%s'";
$arguments[] = $value;
}
$cond = implode(' AND ', $cond);

SomebodySysop’s picture

If you are using OG User Roles, I have resolved this issue here: http://drupal.org/node/194214

Thanks for the help!

Here are some notes I received from the Developer list:

>>* 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.

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.

Mark Theunissen’s picture

Thanks, yes I traced the issue to OG User Roles.

Thanks I'll install the updated module.

Cheers
Mark

SomebodySysop’s picture

OGR Release 2.6 (the latest) does not contain this modification. You'll have to apply the patch in the link I supplied above. These changes will be incorporated in the new version. Thanks!

scottrigby’s picture

I hate to hack core, but spent hours looking in the forums for an answer. This is the only fix that will help.
I'm getting these errors and no telling what's causing them?
Anyway, thanks - hope this can get resolved soon - but in the meantime this fix seems to be working.
(i'm using core 5.7 by the way).

Scott Rigby
http://basekamp.com
http://PlausibleArtworlds.org

neopoet’s picture

I'm not 100% that this solved my problem, but I think it might. Here it is as a patch. Use it at your own risk (really).

http://www.neopoet.net/node-164499-0.patch

newswatch’s picture

The patch gives me this error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/north/public_html/modules/node/node.module on line 1925

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/north/public_html/modules/node/node.module on line 1925

-----------------------------
Subir Ghosh
www.subirghosh.in

bflora’s picture

I get this problem all the time...and it's whenever I'm messing with CCK fields and templating. For instance, if you create a field for a CCK type and then story its value to a variable in your template. Then at some point later you delete that field from the CCK type but keep calling it in your template....FAIL. You get the errors seen here.

Summit’s picture

Subscribing, may be duplicate of each other: www.drupal.org/node/142286. Greetings, Martijn