diff --git a/includes/common.inc b/includes/common.inc index c6303ef..ab93da6 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7825,7 +7825,8 @@ 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]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($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 62359a9..4e35bf7 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -187,6 +187,11 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface { if (!empty($ids)) { $this->cleanIds($ids); } + + // Ensure integer revision ID is valid. + if (!empty($revision_id)) { + $this->cleanIds($revision_id); + } // 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 @@ -248,6 +253,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); + } + } } /**