I received this old script from a client which was still running on an old server with PHP 4.4. We placed it on a new server with PHP 5.6 and it doesn't work anymore how it was supposed to work.
The script saves a form to a XML file and retrieves the info from the XML into the form again. Problem is that it doesn't retrieve it anymore. We get this error:
PHP Fatal error: Call to a member function getAttribute() on null
Here is the part of the code where it goes wrong.
if(!$xml_page->parseXML($strXMLToCContents)){
$show_errors .= "Parsing failed.<br>";
}
$nodeRoot =& $xml_page->documentElement;
$nodeToCDef =& $nodeRoot->firstChild;
$strToCButtonLabel = $nodeToCDef->getAttribute("name");
$countToCRows = $nodeToCDef->childCount;
for($n = 0; $n < $countToCRows; $n++){
$thisLinkNode =& $nodeToCDef->childNodes[$n];
$arrLinks[] = array($thisLinkNode->getAttribute("name"), $thisLinkNode->getAttribute("page"));
}
}
}
if(count($arrLinks) == 0){
for($n = 0; $n < $numFormFieldsToShow; $n++){
$arrLinks[] = array('', '');
}
}
Any ideas what needs to be changed to get it to work again. Thanks!