Annotation of embedaddon/php/ext/dom/tests/bug36756.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #36756 (DOMDocument::removeChild corrupts node)
! 3: --SKIPIF--
! 4: <?php require_once('skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: /* Node is preserved from removeChild */
! 9: $dom = new DOMDocument();
! 10: $dom->loadXML('<root><child/></root>');
! 11: $xpath = new DOMXpath($dom);
! 12: $node = $xpath->query('/root')->item(0);
! 13: echo $node->nodeName . "\n";
! 14: $dom->removeChild($GLOBALS['dom']->firstChild);
! 15: echo "nodeType: " . $node->nodeType . "\n";
! 16:
! 17: /* Node gets destroyed during removeChild */
! 18: $dom->loadXML('<root><child/></root>');
! 19: $xpath = new DOMXpath($dom);
! 20: $node = $xpath->query('//child')->item(0);
! 21: echo $node->nodeName . "\n";
! 22: $GLOBALS['dom']->removeChild($GLOBALS['dom']->firstChild);
! 23:
! 24: echo "nodeType: " . $node->nodeType . "\n";
! 25:
! 26: ?>
! 27: --EXPECTF--
! 28: root
! 29: nodeType: 1
! 30: child
! 31:
! 32: Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d
! 33:
! 34: Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
! 35: nodeType:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>