summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc6
-rw-r--r--includes/path.inc2
2 files changed, 7 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 220414a2d..be7c72234 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5955,6 +5955,12 @@ function drupal_write_record($table, &$record, $primary_keys = array()) {
$serial = $field;
}
+ // Skip field if it is in $primary_keys as it is unnecessary to update a
+ // field to the value it is already set to.
+ if (in_array($field, $primary_keys)) {
+ continue;
+ }
+
if (!property_exists($object, $field)) {
// Skip fields that are not provided, default values are already known
// by the database.
diff --git a/includes/path.inc b/includes/path.inc
index ac78b0a74..3b5549656 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -397,7 +397,7 @@ function path_save(&$path) {
$path += array('pid' => NULL, 'language' => LANGUAGE_NONE);
// Insert or update the alias.
- $status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : NULL));
+ $status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : array()));
// Verify that a record was written.
if ($status) {