mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
9bd9e9a867
* PHP-8.0: Fix #79451: DOMDocument->replaceChild on doctype causes double free
21 lines
520 B
PHP
21 lines
520 B
PHP
--TEST--
|
|
Bug #79451 (Using DOMDocument->replaceChild on doctype causes double free)
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
$dom = new \DOMDocument();
|
|
$dom->loadHTML("<!DOCTYPE html><p>hello</p>");
|
|
$impl = new \DOMImplementation();
|
|
$dt = $impl->createDocumentType("html_replace", "", "");
|
|
$dom->replaceChild($dt, $dom->doctype);
|
|
|
|
var_dump($dom->doctype->name);
|
|
echo $dom->saveXML();
|
|
?>
|
|
--EXPECTF--
|
|
string(12) "html_replace"
|
|
<?xml version="1.0" standalone="yes"?>
|
|
<!DOCTYPE html_replace>
|
|
<html><body><p>hello</p></body></html>
|