the $placeholders variable isn't declared, and is only set within a conditional. when the $object arg of drupal_write_record() is an empty object, $placeholders never gets set, resulting in an error when implode($placeholders) is called (common.inc, line 3288).

CommentFileSizeAuthor
common-drupal_write_record.patch630 bytesbecw

Comments

bdragon’s picture

Additional info:
The situation where this happens is a table with a single serial column.
We encountered this when porting a module from 5 (there had previously been a db_next_id() call to create a new thread id if it was nonexistent, we switched this to inserting rows in a table, but didn't have any additional columns to add at the time.

dropcube’s picture

Status: Needs review » Reviewed & tested by the community

Exactly, tested trying to insert an object with only one serial field and there are no placeholders in the query. It is easy to see in the code and the patch is simple, so for me it's RTBC.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.