From 42b0c414557e64c4184c3c357e9d7dbfa27ccde8 Mon Sep 17 00:00:00 2001
From: Alan Davison <spittlehill@hotmail.com>
Date: Sun, 6 Mar 2011 11:40:27 -0500
Subject: [PATCH 1/2] Issue #1003788: Filter to prevent PDOException within EntityController::load().

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

diff --git a/includes/entity.inc b/includes/entity.inc
index 33c768c..225c007 100644
--- a/includes/entity.inc
+++ b/includes/entity.inc
@@ -159,6 +159,16 @@ 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)) {
+      foreach ($ids as $index => $value) {
+        if ($value !== '' && (!is_numeric($value) || intval($value) != $value)) {
+          unset($ids[$index]);
+        }
+      }
+    }
+
     // 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.3.1.msysgit.0


From 8df12381e82bace8a3944808506719342dff8df4 Mon Sep 17 00:00:00 2001
From: Alan Davison <spittlehill@hotmail.com>
Date: Sun, 6 Mar 2011 11:50:16 -0500
Subject: [PATCH 2/2] Issue #1003788: Filter to prevent PDOException within EntityController::load().

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

diff --git a/includes/entity.inc b/includes/entity.inc
index 225c007..1c697e5 100644
--- a/includes/entity.inc
+++ b/includes/entity.inc
@@ -163,7 +163,7 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
     // in from various sources, including menu callbacks.
     if (is_array($ids)) {
       foreach ($ids as $index => $value) {
-        if ($value !== '' && (!is_numeric($value) || intval($value) != $value)) {
+        if (intval($value) != $value) {
           unset($ids[$index]);
         }
       }
-- 
1.7.3.1.msysgit.0

