1--TEST-- 2replaceChild() where the old node is not a child 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7$document = new DOMDocument(); 8$real_parent = $document->createElement('real'); 9$parent = $document->createElement('p'); 10$child1 = $document->createElement('child1'); 11$child2 = $document->createElement('child2'); 12$child3 = $document->createElement('child3'); 13$real_parent->appendChild($child1); 14$parent->appendChild($child2); 15try { 16 $parent->replaceChild($child3, $child1); 17} catch (DOMException $e) { 18 echo "DOMException: " . $e->getMessage(); 19} 20--EXPECT-- 21DOMException: Not Found Error 22