Bug #55538 [Com]: Error when unsetting a child of an SimpleXmlElement

From: Date: Mon, 15 Oct 2012 10:20:40 +0000
Subject: Bug #55538 [Com]: Error when unsetting a child of an SimpleXmlElement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174089@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55538&edit=1

 ID:                 55538
 Comment by:         opensource at prodigy7 dot de
 Reported by:        csnaitsirch at web dot de
 Summary:            Error when unsetting a child of an SimpleXmlElement
 Status:             Open
 Type:               Bug
 Package:            SimpleXML related
 Operating System:   Windows 7
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Can confirm this behaviour. Please fix or tell us, what we do wrong.


Previous Comments:
------------------------------------------------------------------------
[2011-08-30 11:26:06] csnaitsirch at web dot de

I forgot to mention, that the node is removed correctly. The only problem is the error message.

------------------------------------------------------------------------
[2011-08-30 11:21:12] csnaitsirch at web dot de

Description:
------------
Hi. I want to remove a child element of an SimpleXmlElement. But that produces a strange error and I
think it's a bug.

This is the error message: Warning: main() [function.main]: Node no longer exists in
C:\xampp\htdocs\test.php on line 5

It is very easy to reproduce. Pleas look at the test script.

Test script:
---------------
<?php
$xml = "<root><a><aa></aa></a></root>";
$xml = simplexml_load_string($xml);

foreach ($xml as $tag => $child) {
	unset($xml->{$tag});
}

Expected result:
----------------
No errors.

Actual result:
--------------
Warning: main() [function.main]: Node no longer exists in C:\xampp\htdocs\test.php on line 5


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55538&edit=1


Thread (8 messages)

« previous php.bugs (#174089) next »