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
This commit is contained in:
NightJar 2017-03-24 11:52:35 +13:00 committed by GitHub
parent 40a1ce4ee8
commit ea4b6f5357

View File

@ -454,6 +454,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$options = $this->getOptions(); $options = $this->getOptions();
if (!$options || !$options->hasExtension($this->class)) {
return false;
}
if ($options->OwnerGroups()->count() == 0 && $options->OwnerUsers()->count() == 0) { if ($options->OwnerGroups()->count() == 0 && $options->OwnerUsers()->count() == 0) {
return false; return false;
} }