Merge pull request #23258 from civicrm/5.49
[civicrm-core.git] / CRM / Core / Permission / Backdrop.php
index 09411c38fa12316ba9046f0446f77f15354e723f..6fc230a4a324aceeb495bd57b433d1c842b48f5c 100644 (file)
@@ -68,7 +68,7 @@ class CRM_Core_Permission_Backdrop extends CRM_Core_Permission_DrupalBase {
     }
     if (function_exists('user_access')) {
       $account = NULL;
-      if ($userId) {
+      if ($userId || $userId === 0) {
         $account = user_load($userId);
       }
       return user_access($str, $account);
@@ -109,7 +109,7 @@ class CRM_Core_Permission_Backdrop extends CRM_Core_Permission_DrupalBase {
     $modules = system_get_info('module');
     foreach ($modules as $moduleName => $module) {
       $prefix = isset($module['name']) ? ($module['name'] . ': ') : '';
-      foreach (module_invoke($moduleName, 'permission') as $permName => $perm) {
+      foreach (module_invoke($moduleName, 'permission') ?? [] as $permName => $perm) {
         if (isset($allCorePerms[$permName])) {
           continue;
         }