--TEST-- DOMChildNode methods without a parent --EXTENSIONS-- dom --FILE-- loadXML(<< XML); $container = $doc->documentElement; $child = $container->firstElementChild; $test = $doc->createElement('foo'); foreach (['before', 'after', 'replaceWith'] as $method) { echo "--- $method ---\n"; $test->$method($child); echo $doc->saveXML(); echo $doc->saveXML($test), "\n"; } ?> --EXPECT-- --- before --- --- after --- --- replaceWith ---