|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19247 set_content does not replace contents
Submitted: 2002-09-05 07:39 UTC Modified: 2002-09-26 19:54 UTC
Avg. Score:4.2 ± 0.8
Reproduced:3 of 4 (75.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dan at exaci dot com Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 4.2.2 OS: Redhat 7.3 kernel 2.4.18-3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: dan at exaci dot com
New email:
PHP Version: OS:


 [2002-09-05 07:39 UTC] dan at exaci dot com
As of v4.2.2 of PHP, with libxml version 2.4.19, set_content does not replace the content of the node, but only appends to it. Apache version is 1.3.26
There is no direct function to overwrite the contents of a node, and to do so requires a roundabout way of creating a new node, copying the children and properties, and then setting the content of that node and replace_node'ing it into the DoM. There should be. That, or set_content should have the expected behaviour of replacing the node content (if appending is required, that can be done by using get_content).

Thanks in advance,



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-05 09:59 UTC]
If you xml is:

  <Node attr="1">
    some text here

and you try to use set_content on the "Node" node it will append, but what happens when you use set_content on the "some text here" child node of type XML_TEXT_NODE?

 [2002-09-26 19:54 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2003-06-06 08:27 UTC] tilman dot giese at globalview dot de
Well, I have the same problem in replacing a node's 
content. My point of view is that if you use get_content() 
on the "Node" node above to retrieve the text content 
"some text here" you should also be able to replace this 
content by calling set_content(). 
Otherwise, can you tell me a fast way to replace the 
content of such a node? I would really appreciate if 
set_content() would replace the content rather than 
appending it. 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 05:01:30 2024 UTC