xref: /PHP-8.2/ext/dom/tests/gh16535.phpt (revision 51b642f2)
1--TEST--
2GH-16535 (UAF when using document as a child)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$v2 = new DOMDocument("t");
9
10$v2->loadHTML("t");
11$v4 = $v2->createElement('foo');
12try {
13    $v4->appendChild($v2);
14} catch (DOMException $e) {
15    echo $e->getMessage(), "\n";
16}
17$v2->loadHTML("oU");
18echo $v2->saveXML();
19
20?>
21--EXPECT--
22Hierarchy Request Error
23<?xml version="1.0" standalone="yes"?>
24<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
25<html><body><p>oU</p></body></html>
26