xref: /PHP-8.2/ext/dom/tests/gh16593.phpt (revision d89dd28d)
1--TEST--
2GH-16593 (Assertion failure in DOM->replaceChild)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7
8$doc = new DOMDocument;
9$root = $doc->appendChild($doc->createElement('root'));
10$child = $root->appendChild($doc->createElement('child'));
11try {
12    $root->replaceChild($doc->createAttribute('foo'), $child);
13} catch (DOMException $e) {
14    echo $e->getMessage(), "\n";
15}
16echo $doc->saveXML();
17
18?>
19--EXPECT--
20Hierarchy Request Error
21<?xml version="1.0"?>
22<root><child/></root>
23