1--TEST-- 2DOMDocument::getElementsByTagName() liveness with DOMDocument::xinclude() 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8// Adapted from https://www.php.net/manual/en/domdocument.xinclude.php 9$xml = <<<EOD 10<?xml version="1.0" ?> 11<chapter xmlns:xi="http://www.w3.org/2001/XInclude"> 12 <p>Hello</p> 13 <para> 14 <xi:include href="book.xml"> 15 <xi:fallback> 16 <p>xinclude: book.xml not found</p> 17 </xi:fallback> 18 </xi:include> 19 </para> 20</chapter> 21EOD; 22 23$dom = new DOMDocument; 24$dom->loadXML($xml); 25$elements = $dom->getElementsByTagName('p'); 26var_dump($elements->item(0)->textContent); 27@$dom->xinclude(); 28var_dump($elements->item(1)->textContent); 29echo $dom->saveXML(); 30 31?> 32--EXPECT-- 33string(5) "Hello" 34string(28) "xinclude: book.xml not found" 35<?xml version="1.0"?> 36<chapter xmlns:xi="http://www.w3.org/2001/XInclude"> 37 <p>Hello</p> 38 <para> 39 40 <p>xinclude: book.xml not found</p> 41 42 </para> 43</chapter> 44