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

From: Date: Wed, 14 Oct 2015 16:07:38 +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-196605@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:         paul at muckypuddle dot com
 Reported by:        csnaitsirch at web dot de
 Summary:            Error when unsetting a child of an SimpleXmlElement
 Status:             Verified
 Type:               Bug
 Package:            SimpleXML related
 Operating System:   Windows 7
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

I think removing the warning is a valid solution here.


Previous Comments:
------------------------------------------------------------------------
[2015-05-12 21:35:47] csnaitsirch at web dot de

Maybe one could just remove the line 'php_error_docref(NULL, E_WARNING, "Node no longer
exists");', because it is just working fine. Or is there a further purpose for this
warning?

HHVM does not output any warning (see http://3v4l.org/edMDh)

------------------------------------------------------------------------
[2015-05-12 17:28:50] cmb@php.net

I'm not sure, whether this qualifies as bug in PHP. Actually,
during the iteration over a collection, removing or adding
elements can always have undesired side effects.

What's happening in this case is that after the first and only
element is deleted, the next node is requested
(php_sxe_move_forward_iterator[1]). However, this fails, because
the current element had been removed, and so GET_NODE[2] triggers
the warning.

[1] <https://github.com/php/php-src/blob/55d94a453243cafc2292920e9c91bd2bc551f2be/ext/simplexml/simplexml.c#L2462-L2477>
[2] <https://github.com/php/php-src/blob/55d94a453243cafc2292920e9c91bd2bc551f2be/ext/simplexml/simplexml.c#L89-L96>

------------------------------------------------------------------------
[2012-10-17 19:51:16] csnaitsirch at web dot de

Sorry, but I am not a core developer. I just made a bug report. I do not know what you made wrong. I
just see that there is something wrong...

------------------------------------------------------------------------
[2012-10-15 10:20:40] opensource at prodigy7 dot de

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

------------------------------------------------------------------------
[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.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=55538


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


Thread (8 messages)

« previous php.bugs (#196605) next »