php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28483 domxml elements unique ids changes when you call a method
Submitted: 2004-05-22 07:39 UTC Modified: 2004-05-24 00:10 UTC
From: vpupkin at comcast dot net Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.4 OS: Linux Fedora Core 1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 - 39 = ?
Subscribe to this entry?

 
 [2004-05-22 07:39 UTC] vpupkin at comcast dot net
Description:
------------
a domxml element has "0" field where its unique id lays. When you call a method, those ids change, below is the code to reproduce this.

I used this XML string:
<?xml version="1.0"?>
<test>
	<row>
		<col>a</col>
		<col>b</col>
		<col>b2</col>
	</row>
	<col>c</col>
	<col>d</col>
</test>

Reproduce code:
---------------
$doc = domxml_open_file('test.xml');

//$element = $doc->first_child();

$xp = $doc->xpath_new_context();
$res = $xp->xpath_eval('//col', $xp);

print_r($res->nodeset);

Expected result:
----------------
comment/uncomment the 3rd line you'll see that ids change


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-24 00:10 UTC] rrichards@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The "0" field has nothing to do with an element. Every domxml object has this and its dependant upon when the object was created (calling an additional method returning and object would change the order of object creation).
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 16:01:24 2021 UTC