diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index a63f4e3a..aa4d033b 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -759,8 +759,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi public function InSection($sectionName) { $page = Director::get_current_page(); - while ($page && $page->exists()) { - if ($sectionName == $page->URLSegment) { + while ($page instanceof SiteTree && $page->exists()) { + if ($sectionName === $page->URLSegment) { return true; } $page = $page->Parent();