diff --git a/includes/common.inc b/includes/common.inc index da8996a1b9..fa679f73d8 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7874,6 +7874,7 @@ function entity_get_info($entity_type = NULL) { $entity_info[$name]['base table field types'] = drupal_schema_field_types($entity_info[$name]['base table']); $entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']); if (isset($entity_info[$name]['revision table'])) { + $entity_info[$name]['revision table field types'] = drupal_schema_field_types($entity_info[$name]['revision table']); $entity_info[$name]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($entity_info[$name]['revision table']); } } diff --git a/includes/entity.inc b/includes/entity.inc index e80ce3b89f..7e7cab182d 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -188,6 +188,12 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface { $this->cleanIds($ids); } + // Ensure integer revision ID is valid. + if (!empty($revision_id)) { + $revision_ids = array($revision_id); + $this->cleanIds($revision_ids); + } + // Load any remaining entities from the database. This is the case if $ids // is set to FALSE (so we load all entities), if there are any ids left to // load, if loading a revision, or if $conditions was passed without $ids. @@ -248,6 +254,13 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface { $ids = array_map('intval', $ids); } } + if (isset($entity_info['revision table field types'])) { + $id_type = $entity_info['revision table field types'][$this->idKey]; + if ($id_type == 'serial' || $id_type == 'int') { + $ids = array_filter($ids, array($this, 'filterId')); + $ids = array_map('intval', $ids); + } + } } /**