|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34997 nodeValue is set when should be null
Submitted: 2005-10-27 00:37 UTC Modified: 2005-10-28 08:32 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: php dot net at punk dot co dot nz Assigned:
Status: Wont fix Package: DOM XML related
PHP Version: 5.0.5 OS: Windows XP
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 — but make sure to vote on the bug!
Your email address:
Solve the problem:
24 + 12 = ?
Subscribe to this entry?

 [2005-10-27 00:37 UTC] php dot net at punk dot co dot nz
The nodeValue attribute appears to be set to the concatenation of the contents of all child text nodes.

As far as I understand according to the specification (p36, DOM2-Core.pdf, the nodeValue should be set to NULL for Element node types (and many other node types).

This may be a problem for other node types as well.

Reproduce code:

Includes a sample xml file and output.txt.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-27 00:39 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-10-27 01:10 UTC]
This was done intentionally and as an extension to the DOM specs.  Provides quick access to Element content and is read-only for DOMElement. This is the only node type that this exception was made for.
 [2005-10-28 08:32 UTC] php dot net at punk dot co dot nz
Does this impact memory usage and performance on large documents? As it appears to duplicate a lot of data.

From what I can tell this is not an extension, more a violation of the spec. The spec indicates it should be null, not undefined and open to interpretation.

IMHO it should be changed to reflect the spec and set to null, or if some people do use it, then maybe made an optional setting? And, if doing that, it might be more useful if it didn't concat all the descendant text nodes into the parent, but just contained only the content from any attached text/CDATA nodes. (Actually then I'd find it useful.)

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 22:01:26 2024 UTC