1--TEST-- 2GH-11830 (ParentNode methods should perform their checks upfront) - hierarchy variation 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7function test($method) { 8 $doc = new DOMDocument; 9 $doc->loadXML(<<<XML 10 <?xml version="1.0"?> 11 <container> 12 <alone/> 13 <child><testelement/></child> 14 </container> 15 XML); 16 17 $container = $doc->documentElement; 18 $alone = $container->firstElementChild; 19 $testElement = $alone->nextElementSibling->firstElementChild; 20 21 try { 22 $testElement->$method($alone, $container); 23 } catch (\DOMException $e) { 24 echo $e->getMessage(), "\n"; 25 } 26 27 echo $doc->saveXML(); 28} 29 30test("prepend"); 31test("append"); 32test("before"); 33test("after"); 34test("replaceWith"); 35?> 36--EXPECT-- 37Hierarchy Request Error 38<?xml version="1.0"?> 39Hierarchy Request Error 40<?xml version="1.0"?> 41Hierarchy Request Error 42<?xml version="1.0"?> 43Hierarchy Request Error 44<?xml version="1.0"?> 45Hierarchy Request Error 46<?xml version="1.0"?> 47