From 1b6442058d20ad9bf8ab27a31112f07437617e73 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Mon, 3 Aug 2015 16:49:18 +0100 Subject: [PATCH] Check that method 'hasMethod' exists in GridFieldSortableHeader --- forms/gridfield/GridFieldSortableHeader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/gridfield/GridFieldSortableHeader.php b/forms/gridfield/GridFieldSortableHeader.php index cfd4983c4d6..13c08cd8637 100644 --- a/forms/gridfield/GridFieldSortableHeader.php +++ b/forms/gridfield/GridFieldSortableHeader.php @@ -111,7 +111,7 @@ public function getHTMLFragments($gridField) { if($tmpItem instanceof SS_List) { // It's impossible to sort on a HasManyList/ManyManyList break; - } elseif($tmpItem->hasMethod($methodName)) { + } elseif(method_exists($tmpItem, 'hasMethod') && $tmpItem->hasMethod($methodName)) { // The part is a relation name, so get the object/list from it $tmpItem = $tmpItem->$methodName(); } elseif($tmpItem instanceof DataObject && $tmpItem->hasField($methodName)) {