|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42437 Results from xpath() cannot be deleted
Submitted: 2007-08-27 08:23 UTC Modified: 2007-08-27 10:29 UTC
From: guenther dot stadler at gmx dot net Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.2.3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: guenther dot stadler at gmx dot net
New email:
PHP Version: OS:


 [2007-08-27 08:23 UTC] guenther dot stadler at gmx dot net
Elements of the array returned by xpath() cannot be deleted.
I can change those elements, but deleting is impossible.

How can I delete a node returned by xpath()? Is there a way to find out where the node I found is within the whole xml tree?

Thanks, G?nther.

Reproduce code:
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
 <movie>Movie One</movie>
 <movie>Movie Two</movie>

$xml = new SimpleXMLElement($xmlstr);

$movs = $xml->xpath('//movie');

// Trying to delete the reference returned by xpath

// $movs[0] = NULL; doesn't work either

// No changes
echo $xml->asXML();


Expected result:
<?xml version="1.0" standalone="yes"?>
 <movie>Movie Two</movie>

Actual result:
<?xml version="1.0" standalone="yes"?>
 <movie>Movie One</movie>
 <movie>Movie Two</movie>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-27 10:29 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 07:01:28 2024 UTC