mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
003ebdd039
Change the way lifetime works in ext/libxml and ext/dom Previously, a node could be freed even when holding a userland reference to it. This resulted in exceptions when trying to access that node after it has been implicitly or explicitly removed. After this patch, a node will only be freed when the last userland reference disappears. Fixes GH-9628. Closes GH-11576.
23 lines
580 B
PHP
23 lines
580 B
PHP
--TEST--
|
|
Delayed freeing dtd node
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
$doc = new DOMDocument;
|
|
$dtd = $doc->implementation->createDocumentType('qualified name', 'public', 'system');
|
|
$doc = $doc->implementation->createDocument('', '', $dtd);
|
|
echo $doc->saveXML(), "\n";
|
|
unset($doc);
|
|
echo $dtd->ownerDocument->saveXML();
|
|
$dtd->ownerDocument->removeChild($dtd);
|
|
var_dump($dtd->ownerDocument->nodeName);
|
|
?>
|
|
--EXPECT--
|
|
<?xml version="1.0"?>
|
|
<!DOCTYPE qualified name PUBLIC "public" "system">
|
|
|
|
<?xml version="1.0"?>
|
|
<!DOCTYPE qualified name PUBLIC "public" "system">
|
|
string(9) "#document"
|