php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #18200 xpath_eval should return a reference to the DOM node and not a copy
Submitted: 2002-07-06 14:06 UTC Modified: 2004-08-27 10:20 UTC
From: lrargerich at yahoo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.1 OS: All
Private report: No CVE-ID: None
 [2002-07-06 14:06 UTC] lrargerich at yahoo dot com
Now, the xpath_eval function returns a copy of the DOM nodes
in the nodeset array, in my opinion the nodeset should be
an array of references to DOMNodes in the tree. In this way
if you change a node in the result set the document changes.

If you find this problematic for existing applications you
might want to add an aditional parameter to xpath_eval allowing the user to indicate if he wants references or
copies back. 

However in my opinion xpath_eval should return references
and if the user wants a copy he just makes the copy himself.

This change allows a lot of interesting features to XML editing using Xpath selectors from PHP.

This will allow, for example, an easy implementation of XUpdate using the DOM extension.

Thanks for reading my suggestion.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-06 14:23 UTC] derick@php.net
reclassify
 [2004-08-27 10:20 UTC] chregu@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

This is certainly fixed in PHP 5, don't know about PHP 4, but we won't add features to PHP 4 anyway
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 07:01:28 2024 UTC