1--TEST-- 2GH-11830 (ParentNode methods should perform their checks upfront) - type variation 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7$doc = new DOMDocument; 8$doc->loadXML(<<<XML 9<?xml version="1.0"?> 10<container> 11 <test/> 12 <child><testelement/></child> 13</container> 14XML); 15 16$testElement = $doc->documentElement->firstElementChild->nextElementSibling->firstElementChild; 17 18try { 19 $doc->documentElement->firstElementChild->prepend($testElement, 0); 20} catch (\TypeError $e) { 21 echo $e->getMessage(), "\n"; 22} 23 24try { 25 $doc->documentElement->firstElementChild->append($testElement, true); 26} catch (\TypeError $e) { 27 echo $e->getMessage(), "\n"; 28} 29 30try { 31 $doc->documentElement->firstElementChild->before($testElement, null); 32} catch (\TypeError $e) { 33 echo $e->getMessage(), "\n"; 34} 35 36try { 37 $doc->documentElement->firstElementChild->after($testElement, new stdClass); 38} catch (\TypeError $e) { 39 echo $e->getMessage(), "\n"; 40} 41 42try { 43 $doc->documentElement->firstElementChild->replaceWith($testElement, []); 44} catch (\TypeError $e) { 45 echo $e->getMessage(), "\n"; 46} 47 48echo $doc->saveXML(); 49?> 50--EXPECT-- 51DOMElement::prepend(): Argument #2 must be of type DOMNode|string, int given 52DOMElement::append(): Argument #2 must be of type DOMNode|string, bool given 53DOMElement::before(): Argument #2 must be of type DOMNode|string, null given 54DOMElement::after(): Argument #2 must be of type DOMNode|string, stdClass given 55DOMElement::replaceWith(): Argument #2 must be of type DOMNode|string, array given 56<?xml version="1.0"?> 57<container> 58 <test/> 59 <child><testelement/></child> 60</container> 61