xref: /PHP-8.4/ext/dom/tests/gh16152.phpt (revision d4a4d2e7)
1--TEST--
2GH-16152 (Memory leak in DOMProcessingInstruction/DOMDocument)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8function test($fname) {
9    $doc = new DOMDocument();
10    $instr = new DOMProcessingInstruction("tr", "r");
11    $frag = new DOMDocumentFragment();
12    $frag2 = new DOMDocumentFragment();
13    $frag2->append($instr);
14    $frag->append($frag2);
15    $doc->{$fname}($frag);
16    echo $doc->saveXML();
17}
18
19test('insertBefore');
20test('appendChild');
21
22?>
23--EXPECT--
24<?xml version="1.0"?>
25<?tr r?>
26<?xml version="1.0"?>
27<?tr r?>
28