mirror of
https://github.com/php/php-src.git
synced 2024-10-21 00:12:34 +00:00
b96a8a79ba
add test
32 lines
672 B
PHP
32 lines
672 B
PHP
--TEST--
|
|
Bug #42112 (deleting a node produces memory corruption)
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded('dom')) die('skip'); ?>
|
|
--FILE--
|
|
<?php
|
|
$xml = <<<EOXML
|
|
<root><child xml:id="id1">baz</child></root>
|
|
EOXML;
|
|
|
|
function remove_node($doc) {
|
|
$node = $doc->getElementById( 'id1' );
|
|
print 'Deleting Node: '.$node->nodeName."\n";
|
|
$node->parentNode->removeChild( $node );
|
|
}
|
|
|
|
$doc = new DOMDocument();
|
|
$doc->loadXML($xml);
|
|
|
|
remove_node($doc);
|
|
|
|
$node = $doc->getElementById( 'id1' );
|
|
if ($node) {
|
|
print 'Found Node: '.$node->nodeName."\n";
|
|
}
|
|
$root = $doc->documentElement;
|
|
print 'Root Node: '.$root->nodeName."\n";
|
|
?>
|
|
--EXPECT--
|
|
Deleting Node: child
|
|
Root Node: root
|