1--TEST--
2Test writing Element::$innerHTML on XML documents - error cases
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = DOM\XMLDocument::createFromString(<<<XML
9<!DOCTYPE root [
10    <!ENTITY foo "content">
11]>
12<root/>
13XML);
14$child = $dom->documentElement->appendChild($dom->createElementNS('urn:a', 'child'));
15$original = $dom->saveXML();
16
17function test($child, $html) {
18    global $dom, $original;
19    try {
20        $child->innerHTML = $html;
21    } catch (DOMException $e) {
22        echo $e->getMessage(), "\n";
23    }
24    var_dump($dom->saveXML() === $original);
25}
26
27test($child, '&foo;');
28test($child, '</root>');
29test($child, '</root><foo/><!--');
30test($child, '--></root><!--');
31test($child, '<');
32test($child, '<!ENTITY foo "content">');
33
34?>
35--EXPECT--
36XML fragment is not well-formed
37bool(true)
38XML fragment is not well-formed
39bool(true)
40XML fragment is not well-formed
41bool(true)
42XML fragment is not well-formed
43bool(true)
44XML fragment is not well-formed
45bool(true)
46XML fragment is not well-formed
47bool(true)
48