1--TEST-- 2Bug #43364 (recursive xincludes don't remove internal xml nodes properly) 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7function loopElements($nodes) 8{ 9 $count = 0; 10 foreach($nodes as $node) { 11 if($node instanceof DOMElement) { 12 $count++; 13 if($node->childNodes->length > 0) { 14 $count += loopElements($node->childNodes); 15 } 16 } 17 } 18 return $count; 19} 20 21$xml = <<<DOC 22<?xml version="1.0" encoding="UTF-8"?> 23<root xmlns:xi="http://www.w3.org/2001/XInclude"> 24 <a> 25 <a_child1>ac1</a_child1> 26 <a_child2>ac2</a_child2> 27 </a> 28 <b><xi:include xpointer="xpointer(/root/a)" /></b> 29 <c><xi:include xpointer="xpointer(/root/b)" /></c> 30</root> 31DOC; 32 33$doc = new DomDocument(); 34$doc->loadXml($xml); 35$doc->xinclude(); 36 37$count = loopElements(array($doc->documentElement)); 38 39var_dump($count == 13 || $count == 11); 40?> 41--EXPECT-- 42bool(true) 43