From a83c5670f2dab6fed255cf620d4ef7cb8a8bee4b Mon Sep 17 00:00:00 2001
From: Peter Philipp <peter.philipp@cando-image.com>
Date: Sun, 6 Nov 2011 17:21:31 +0100
Subject: [PATCH] Fix possible issue with
 EntityCacheControllerHelper::resetEntityCache()

---
 entitycache.module |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/entitycache.module b/entitycache.module
index 1ba5998..b60123a 100644
--- a/entitycache.module
+++ b/entitycache.module
@@ -26,9 +26,14 @@ class EntityCacheControllerHelper extends DrupalDefaultEntityController {
 
   public static function resetEntityCache($controller, array $ids = NULL) {
     // Reset the persistent cache.
-    if (isset($ids)) {
+    if (!empty($ids)) {
       cache_clear_all($ids, 'cache_entity_' . $controller->entityType);
     }
+    else {
+      // Force all cached entries to be deleted.
+      cache_clear_all('*', 'cache_entity_' . $controller->entityType, TRUE);
+    }
+
     // Give modules the chance to act on any entity.
     foreach (module_implements('entitycache_reset') as $module) {
       $function = $module . '_entitycache_reset';
-- 
1.7.7.msysgit.1

