--- a/includes/entity.inc	2015-06-17 14:38:44.000000000 -0400
+++ b/includes/entity.inc	2015-06-19 11:10:10.045834544 -0400
@@ -167,6 +167,11 @@
       $revision_id = FALSE;
     }
 
+    // Ensure integer entity IDs are valid.
+    if (!empty($ids)) {
+      $this->cleanIds($ids);
+    }
+
     // Create a new variable which is either a prepared version of the $ids
     // array for later comparison with the entity cache, or FALSE if no $ids
     // were passed. The $ids array is reduced as items are loaded from cache,
@@ -183,11 +188,6 @@
       }
     }
 
-    // Ensure integer entity IDs are valid.
-    if (!empty($ids)) {
-      $this->cleanIds($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.
