Edit report at http://bugs.php.net/bug.php?id=52369&edit=1
ID: 52369
Comment by: giorgio dot liscio at email dot it
Reported by: giorgio dot liscio at email dot it
Summary: trying to delete nodes while looping domnodelist do
not delete them
Status: Open
Type: Bug
Package: DOM XML related
Operating System: all
PHP Version: 5.3.2
New Comment:
not a bug?
Previous Comments:
------------------------------------------------------------------------
[2010-07-18 13:14:54] giorgio dot liscio at email dot it
Description:
------------
hi, as summary says
here is the test code
<?php
$s = '<div><abc /><abc /><abc /><abc /></div>';
$a = new DOMDocument(); $a->loadXML($s);
$els = $a->getElementsByTagName("abc");
// uncomment those three lines to fix
//foreach($els as $b)
// $els2[]=$b;
//$els=$els2;
foreach($els as $el)
$el->parentNode->removeChild($el);
echo "<textarea rows=20 cols=50>";
echo "document element (<div>) should be empty:\n";
echo $a->saveXML();
?>
uncomment lines to see the expected behavior
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52369&edit=1