xref: /php-src/ext/dom/tests/gh16039.phpt (revision 043b9e1f)
1--TEST--
2GH-16039 (Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$dom = new DOMDocument;
9$element = $dom->appendChild($dom->createElement('root'));
10try {
11    $element->prepend('x', new DOMEntity);
12} catch (DOMException $e) {
13    echo $e->getMessage(), "\n";
14}
15echo $dom->saveXML();
16$dom->strictErrorChecking = false; // Should not have influence
17try {
18    $element->prepend('x', new DOMEntity);
19} catch (DOMException $e) {
20    echo $e->getMessage(), "\n";
21}
22echo $dom->saveXML();
23
24?>
25--EXPECT--
26Invalid State Error
27<?xml version="1.0"?>
28<root/>
29Invalid State Error
30<?xml version="1.0"?>
31<root/>
32