MySQL Error

budda - April 24, 2007 - 09:23
Project:GlobalNode
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

When this module is enabled it's causing a MySQL query error:

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

I disable the module and it goes away. What's odd is that I can't see why this module would cause the error when it does no dbase query or node_load() etc. calls.

I resolved the issue by changing the hook_nodeapi() call to build the $GLOBALS['globalnode'] during the 'view' operation.

      switch($op){
        case 'view':
          foreach($attributes as $att){
            if($node->$att){
              $GLOBALS['globalnode']->$att = $node->$att;
            }
          }
          break;
      }

#1

dllh - May 6, 2007 - 03:04
Version:<none>» 5.x-1.x-dev
Status:active» fixed

This was addressed in the patch you submitted, which I've committed. Thanks!

#2

Anonymous - May 20, 2007 - 03:30
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.