Fix array_search notice from null array in CRM_Core_Permission::event
authorDave Greenberg <dave@civicrm.org>
Sun, 30 Jun 2013 18:00:14 +0000 (11:00 -0700)
committerDave Greenberg <dave@civicrm.org>
Sun, 30 Jun 2013 18:00:14 +0000 (11:00 -0700)
CRM/Core/Permission.php

index 7ed36300112d33de07f543b90ed8ccc750c43cc8..6ca3f84fe93e9f1f9527f12c579bd8f37dc3e883 100644 (file)
@@ -279,7 +279,11 @@ class CRM_Core_Permission {
     if (!$eventID) {
       return $permissionedEvents;
     }
-    return array_search($eventID, $permissionedEvents) === FALSE ? NULL : $eventID;
+    if (!empty($permissionedEvents)){
+      return array_search($eventID, $permissionedEvents) === FALSE ? NULL : $eventID;      
+    } else {
+      return $eventID;
+    }
   }
 
   static function eventClause($type = CRM_Core_Permission::VIEW, $prefix = NULL) {