Thanks, boen_robot! We installed the new PHP version 5.4.5 and are going to install the new libxml2 version 2.8.0 soon. Anyway, I found a workaround i.e. now I save the modified XML file first, open the saved XML file and do the transformation finally. Here is the modified code snippet:
$xml = new DOMDocument; $xml->formatOutput = true; $xml->load("xml/$hostname.log.xml"); $elements = $xml->getElementsByTagName("*"); foreach($elements as $element) { $type = $element->getAttribute('type'); $title = $element->getAttribute('title'); if($type == 'comment' or $title == 'Installed Packages') { foreach($element->childNodes as $item) { if($item->nodeType == 4) // XML_CDATA_SECTION_NODE { $cdataWrapper = $xml->createElement("wrapper", $item->nodeValue); $element->parentNode->appendChild($cdataWrapper); } } } } // WA for segmentation fault starts here ... $xml->save("xml/$hostname.wrapper.xml"); $xml = new DOMDocument; $xml->formatOutput = true; $xml->load("xml/$hostname.wrapper.xml"); // WA for segmentation fault ends here ... $xsl = new DOMDocument; $xsl->load("xml/wrapper.xsl"); $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); print(trim($proc->transformToXML($xml))); // --> Might cause a segmentation fault