When building the query for updating or saving a node, the node_save calls in_array to determine the fields to add to the query. If by chance there $node->0 is set, it will match using in_array. I am not sure why. $node->0 gets set in some cases when node_invoke_nodeapi gets called and one of the methods returns a non-array. Then, when going to save this node, the query fails like this:

user error: 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 '0 = '' WHERE nid = '786'' at line 1
query: UPDATE v_node SET nid = '786', type = 'acidfree', title = 'arm', uid = '1', status = '1', created = '1126888157', changed = '1127835669', comment = '2', promote = '0', moderate = '0', teaser = '', body = '', revisions = '', sticky = '0', format = '0', 0 = '' WHERE nid = '786' in /var/www/drupal-4.6.3/includes/database.mysql.inc on line 66.

Note the 0 = '' right before 'WHERE nid =' This is the problem. Somehow, the 0 field got past the in_array check. I did a test and if we use the strict parameter for in_array, this does not happen.

CommentFileSizeAuthor
#1 node.module-in_array.patch643 bytesvhmauery

Comments

vhmauery’s picture

Status: Active » Needs review
StatusFileSize
new643 bytes

Here is a patch that fixes the problem.

alaa’s picture

Status: Needs review » Reviewed & tested by the community

confirming, this bug is causing errors for aggregator2 as reported in http://drupal.org/node/37722 adding the strict requirement solves the problem

maybe the reason why $node->0 gets set should be investigated too.

dries’s picture

Status: Reviewed & tested by the community » Needs work

We should look for the cause. This only patches the symptoms.

magico’s picture

Version: 4.6.3 » 4.6.9
Status: Needs work » Active

Still happening?

vhmauery’s picture

I don't know if it is still happening -- I have updated all my systems to 4.7. As far as I care, this doesn't matter any more. If nobody else cares, you can close it. I hardly have enough time keeping up with the changes from 4.7 and new ones to 4.8 to care about 4.6. But I guess there are a lot of people still stuck with 4.6 that may care about this... But then my advice is to upgrade. :)

chx’s picture

Status: Active » Closed (won't fix)

don't see $node->0 . doh.

chx’s picture

don't set I meant.