diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc index 3e41439f0..ac68ba3e7 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3273,12 +3273,24 @@ function drupal_write_record($table, &$object, $update = array()) { if (empty($info['serialize'])) { $values[] = $object->$field; } - else { + elseif (!empty($object->$field)) { $values[] = serialize($object->$field); } + else { + $values[] = ''; + } } } + if (empty($fields)) { + // No changes requested. + // If we began with an array, convert back so we don't surprise the caller. + if ($array) { + $object = (array)$object; + } + return; + } + // Build the SQL. $query = ''; if (!count($update)) { |