1--TEST-- 2Bug #40836 (Segfault in insertBefore) 3--SKIPIF-- 4<?php require_once('skipif.inc'); ?> 5--FILE-- 6<?php 7$dom = new DOMDocument("1.0", "UTF-8"); 8$dom->preserveWhiteSpace = false; 9$xml = '<?xml version="1.0" encoding="utf-8"?> 10<feed xmlns="http://www.w3.org/2005/Atom"> 11 <entry xmlns="http://www.w3.org/2005/Atom"> 12 <updated>2007-02-14T00:00:00+01:00</updated> 13 <content> 14 <div xmlns="http://www.w3.org/1999/xhtml"> 15 <p>paragraph</p> 16 </div> 17 </content> 18 </entry> 19</feed>'; 20$dom->loadXML($xml); 21$entry = $dom->getElementsByTagNameNS("http://www.w3.org/2005/Atom", "entry")->item(0); 22$contentNode = $entry->getElementsByTagName("content")->item(0)->firstChild; 23$dateNode = $entry->getElementsByTagName("updated")->item(0)->firstChild; 24$contentNode->firstChild->insertBefore($dateNode); 25echo $dom->saveXML(); 26?> 27--EXPECT-- 28<?xml version="1.0" encoding="utf-8"?> 29<feed xmlns="http://www.w3.org/2005/Atom"><entry xmlns="http://www.w3.org/2005/Atom"><updated/><content><div xmlns="http://www.w3.org/1999/xhtml"><p>paragraph2007-02-14T00:00:00+01:00</p></div></content></entry></feed> 30