xref: /php-src/ext/dom/tests/bug79451.phpt (revision 9bd9e9a8)
1--TEST--
2Bug #79451 (Using DOMDocument->replaceChild on doctype causes double free)
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$dom = new \DOMDocument();
8$dom->loadHTML("<!DOCTYPE html><p>hello</p>");
9$impl = new \DOMImplementation();
10$dt = $impl->createDocumentType("html_replace", "", "");
11$dom->replaceChild($dt, $dom->doctype);
12
13var_dump($dom->doctype->name);
14echo $dom->saveXML();
15?>
16--EXPECTF--
17string(12) "html_replace"
18<?xml version="1.0" standalone="yes"?>
19<!DOCTYPE html_replace>
20<html><body><p>hello</p></body></html>
21