I have a site that worked fine and over the weekend my client cant access the maintenance report panel because this error appears
[Notice] Undefined offset: 0
The site works fine on dev so I know its not a php version issue / updating issue. Can anyone assist please? Heres the code it says the error is on line 44 which is return $parentNodes[0];
public function getProblemPath(){
$parentNodes = array_reverse($this->getParent($this->ParentNodeID, array()));
return implode(' -> ', $parentNodes) . ' -> ' . $this->Title;
}
public function getProblemStart(){
$parentNodes = array_reverse($this->getParent($this->ParentNodeID, array()));
return $parentNodes[0];
}
public function getParent($ID, $nodes){
if ($parent = DataObject::get_one("MaintenanceNode", array("ID" => $ID))){
$nodes[] = $parent->Title;
if ($parent->ParentNodeID){
return $this->getParent($parent->ParentNodeID, $nodes);
} else {
return $nodes;
}
} else {
return $nodes;
}
}