From ea4b6f5357d42b1427c27b81d7580cea6d406a46 Mon Sep 17 00:00:00 2001 From: NightJar Date: Fri, 24 Mar 2017 11:52:35 +1300 Subject: [PATCH] Avoid fatal errors when trying to edit in the CMS If a page has it's `ContentReviewType` `Disabled` (either directly or on a parent via a `Inherit`) **AND ** has a `NextReviewDate` in the past, the page will cause a fatal error when attempting to load it for editing in the CMS. We can avoid this by checking if a pages Options are a boolean value (false for disabled) before trying to call methods on it. Addresses issue #55 --- code/extensions/SiteTreeContentReview.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/extensions/SiteTreeContentReview.php b/code/extensions/SiteTreeContentReview.php index 381c369..6b0654d 100644 --- a/code/extensions/SiteTreeContentReview.php +++ b/code/extensions/SiteTreeContentReview.php @@ -454,6 +454,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider $options = $this->getOptions(); + if (!$options || !$options->hasExtension($this->class)) { + return false; + } + if ($options->OwnerGroups()->count() == 0 && $options->OwnerUsers()->count() == 0) { return false; }