summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc14
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)) {