I've been getting this error:

* warning: Invalid argument supplied for foreach() in /home/suppleme/public_html/modules/node/node.module on line 504.
* warning: implode() [function.implode]: Bad arguments. in /home/suppleme/public_html/modules/node/node.module on line 508.
* 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 /home/suppleme/public_html/includes/database.mysql.inc on line 172.

I did some debugging which traced it back to the nodereference module. Turning it off fixes this problem, but as nodereference is an integral part of my site, I cannot turn it off. This problem seemed to happen after installing audio.module. Not even uninstalling and removing all the changes in the DB seemed to fix this problem. Does anyone know what I can do?

CommentFileSizeAuthor
#6 nodereference-1.39.2.17.patch735 bytestraxer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

On what pages does the error happen ?
On all pages, or only on pages displaying nodes containing the noderef field ?
Also, could you try switching back to the default-unaltered Garland theme and see if the error is still here ?

If so, could you provide a copy of an export of your content type (using cck's content_copy.module and the 'export' tab on the content-type list page) ?

cr4zyguy’s picture

Yched, the problem happens on all admin pages. Strangely, after doing the export, I had this brainwave to change the type from author to writer, and this has fixed the problem!! Regardless, I still have attached the export field definitions if it can help prevent future problems from occuring.

$content[type] = array (
'name' => 'Author',
'type' => 'author',
'description' => 'Author for ST articles. This will be the About Author page.',
'title_label' => 'Name',
'body_label' => 'Body',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => false,
'sticky' => false,
'revision' => false,
),
'comment' => '0',
'fivestar' => 0,
'fivestar_position' => 'above',
'leech_for' => 0,
'leech_refresh' => '900',
'leech_news_template' => '23',
'leech_news_items_guid' => 0,
'leech_news_items_status' => 1,
'leech_news_items_update' => 0,
'leech_news_items_delete' => '15724800',
'leech_news_items_promote' => '3',
'leech_news_items_date' => 1,
'leech_news_links' => '0',
'old_type' => 'author',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
);

It seems like the error happened when there is a node reference to the content type 'author'. When I changed the type to 'writer', this problem is fixed.

yched’s picture

I can't seem to reproduce on my own install.

The error lines you mention indicate the error comes from a call to node_load with an invalid (non array / non numeric) first argument.
There are only two node_load calls in nodereference, one on node form validation, the other on node display.
Both occurrences do not match with your stating that the error appears on every admin page (unless by any chance you have a block that displays nodes on every admin page ?)

sarvab’s picture

I've come across this same error myself. I traced it back to the node_load($items['nid']) statement in the nodereference_field_formatter function. For instance if I'm at admin/build/views, and my views url is completely unrelated (a/$arg/b), $item['nid'] seems to get set with 'build' and node_load fails with those error messages.

Not sure if this is a nodereference, content_views, or a views issue, but the only way i see you could resolve it within nodereference is to put in a is_integer check before node_load. That doesnt explain why cr4zyguy was able to switch the content type to fix it though....

traxer’s picture

I have this Probelm with a view under the URL node/$arg/whatever when I go to node/add. Views tries to figure out the title.

This must be a nodereference issue:

  • views.module does not know that I'm not interested in a title
  • content.module should not make assumptions about nodereference.module

I replaced if (!empty($item['nid'])) {} with if ( is_array($item['nid']) || is_numeric($item['nid']) ) {} in my nodereference_field_formatter

Sorry for not providing a patch, no CVS at this place.

traxer’s picture

Status: Active » Reviewed & tested by the community
FileSize
735 bytes

patch for #5

yched’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in latest dev release. I'm not exactly sure what is making the formatter called with a non numeric $item['nid'], but I did not really feel like investigating too much :-(

Anonymous’s picture

Status: Fixed » Closed (fixed)