summaryrefslogtreecommitdiff
path: root/ext/libxml/tests/bug42112.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/libxml/tests/bug42112.phpt')
-rw-r--r--ext/libxml/tests/bug42112.phpt31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/libxml/tests/bug42112.phpt b/ext/libxml/tests/bug42112.phpt
new file mode 100644
index 0000000000..b5a3f40b3e
--- /dev/null
+++ b/ext/libxml/tests/bug42112.phpt
@@ -0,0 +1,31 @@
+--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