mirror of
https://github.com/php/php-src.git
synced 2026-04-27 01:48:26 +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.
24 lines
523 B
PHP
24 lines
523 B
PHP
--TEST--
|
|
Delayed freeing processing instruction
|
|
--EXTENSIONS--
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
$doc = new DOMDocument;
|
|
$pi = $doc->appendChild($doc->createElementNS('some:ns', 'container'))
|
|
->appendChild($doc->createProcessingInstruction('hello', 'world'));
|
|
echo $doc->saveXML(), "\n";
|
|
$pi->parentNode->remove();
|
|
echo $doc->saveXML(), "\n";
|
|
var_dump($pi->parentNode);
|
|
var_dump($pi->nodeValue);
|
|
?>
|
|
--EXPECT--
|
|
<?xml version="1.0"?>
|
|
<container xmlns="some:ns"><?hello world?></container>
|
|
|
|
<?xml version="1.0"?>
|
|
|
|
NULL
|
|
string(5) "world"
|