From 677783639ccb0b2c93d2cf266aca96c36c339f9f Mon Sep 17 00:00:00 2001
From: Joshua Waihi <josh@catalyst.net.nz>
Date: Fri, 1 Apr 2011 09:56:40 +1300
Subject: [PATCH] faster implementation of sanity checking

---
 includes/entity.inc |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/includes/entity.inc b/includes/entity.inc
index 33c768c..bfb5155 100644
--- a/includes/entity.inc
+++ b/includes/entity.inc
@@ -159,6 +159,12 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
   public function load($ids = array(), $conditions = array()) {
     $entities = array();
 
+    // Clean the $ids array to remove non-integer values that can be passed
+    // in from various sources, including menu callbacks.
+    if (is_array($ids)) {
+      $ids = array_filter($ids, 'intval');
+    }
+
     // Revisions are not statically cached, and require a different query to
     // other conditions, so separate the revision id into its own variable.
     if ($this->revisionKey && isset($conditions[$this->revisionKey])) {
-- 
1.7.0.4

