From 987eedf9ba583bcdf0999c01f2183e6f9fe485cf Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 14 Sep 2011 08:41:15 +0200 Subject: [PATCH] BUGFIX Don't fail SiteTree::batch_permission_check() is no published pages exist --- code/model/SiteTree.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 89d8e0b2..7a48e84b 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1099,8 +1099,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid // Start by filling the array with the pages that actually exist $table = ($stage=='Stage') ? "SiteTree" : "SiteTree_$stage"; - $result = array_fill_keys(DB::query("SELECT \"ID\" FROM \"$table\" - WHERE \"ID\" IN (".implode(", ", $ids).")")->column(), false); + $result = array_fill_keys( + ($ids) ? DB::query("SELECT \"ID\" FROM \"$table\" WHERE \"ID\" IN (".implode(", ", $ids).")")->column() : array(), + false + ); // Get the uninherited permissions $uninheritedPermissions = Versioned::get_by_stage("SiteTree", $stage, "(\"$typeField\" = 'LoggedInUsers' OR