xref: /PHP-8.3/ext/dom/tests/gh16338.phpt (revision 5cb38e9d)
1--TEST--
2GH-16338 (Null-dereference in ext/dom/node.c)
3--EXTENSIONS--
4dom
5--CREDITS--
6chibinz
7--FILE--
8<?php
9$ref = new DOMEntityReference("G");
10$com = new DOMComment();
11$doc = new DOMDocument();
12$elem = new DOMElement("Rj", "o");
13$com2 = new DOMComment();
14$elem2 = new DOMElement("kx", null, "r");
15
16$elem2->prepend($com);
17$com->before("Z");
18$com->before($com2);
19$com2->after($elem);
20$doc->insertBefore($elem2);
21$elem->insertBefore($ref);
22
23echo $doc->saveXML();
24?>
25--EXPECT--
26<?xml version="1.0"?>
27<kx xmlns="r">Z<Rj>o&G;</Rj></kx>
28