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.
Comments
Comment #1
vhmauery commentedHere is a patch that fixes the problem.
Comment #2
alaa commentedconfirming, 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.
Comment #3
dries commentedWe should look for the cause. This only patches the symptoms.
Comment #4
magico commentedStill happening?
Comment #5
vhmauery commentedI 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. :)
Comment #6
chx commenteddon't see $node->0 . doh.
Comment #7
chx commenteddon't set I meant.