xref: /php-src/ext/dom/tests/gh16151.phpt (revision 066d18f2)
1--TEST--
2GH-16151 (Assertion failure in ext/dom/parentnode/tree.c)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$element = new DOMElement("N", "W", "y");
9$attr = new DOMAttr("c" , "n");
10$doc = new DOMDocument();
11$doc->appendChild($element);
12$element->setAttributeNodeNS($attr);
13
14try {
15    $attr->insertBefore(new DOMComment("h"));
16} catch (DOMException $e) {
17    echo $e->getMessage(), "\n";
18}
19try {
20    $attr->appendChild(new DOMComment("h"));
21} catch (DOMException $e) {
22    echo $e->getMessage(), "\n";
23}
24
25$attr->insertBefore($doc->createEntityReference('amp'));
26$attr->appendChild($doc->createEntityReference('amp'));
27
28echo $doc->saveXML();
29
30?>
31--EXPECT--
32Hierarchy Request Error
33Hierarchy Request Error
34<?xml version="1.0"?>
35<N xmlns="y" c="n&amp;&amp;">W</N>
36