Annotation of embedaddon/php/ext/dom/tests/bug43364.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #43364 (recursive xincludes don't remove internal xml nodes properly)
3: --SKIPIF--
4: <?php require_once('skipif.inc'); ?>
5: --FILE--
6: <?php
7: function 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>
31: DOC;
32:
33: $doc = new DomDocument();
34: $doc->loadXml($xml);
35: $doc->xinclude();
36:
37: $count = loopElements(array($doc->documentElement));
38:
39: var_dump($count);
40: ?>
41: --EXPECT--
42: int(13)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>