File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / dom / tests / bug36756.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:54 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #36756 (DOMDocument::removeChild corrupts node)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php

/* Node is preserved from removeChild */
$dom = new DOMDocument();
$dom->loadXML('<root><child/></root>');
$xpath = new DOMXpath($dom);
$node = $xpath->query('/root')->item(0);
echo $node->nodeName . "\n";
$dom->removeChild($GLOBALS['dom']->firstChild);
echo "nodeType: " . $node->nodeType . "\n";

/* Node gets destroyed during removeChild */
$dom->loadXML('<root><child/></root>');
$xpath = new DOMXpath($dom);
$node = $xpath->query('//child')->item(0);
echo $node->nodeName . "\n";
$GLOBALS['dom']->removeChild($GLOBALS['dom']->firstChild);

echo "nodeType: " . $node->nodeType . "\n";

?>
--EXPECTF--
root
nodeType: 1
child

Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d

Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
nodeType:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>