File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ DOMDocument::getElementsByTagName() liveness with DOMDocument::xinclude()
3
+ --EXTENSIONS--
4
+ dom
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>
21
+ EOD ;
22
+
23
+ $ dom = new DOMDocument ;
24
+ $ dom ->loadXML ($ xml );
25
+ $ elements = $ dom ->getElementsByTagName ('p ' );
26
+ var_dump ($ elements ->item (0 )->textContent );
27
+ @$ dom ->xinclude ();
28
+ var_dump ($ elements ->item (1 )->textContent );
29
+ echo $ dom ->saveXML ();
30
+
31
+ ?>
32
+ --EXPECT--
33
+ string(5) "Hello"
34
+ string(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>
You can’t perform that action at this time.
0 commit comments