|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15412 set_content() and new_child() methods not creating wellformed XML
Submitted: 2002-02-06 17:34 UTC Modified: 2002-02-06 18:45 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: ken at positive-edge dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.1.1 OS: WindowsXP
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: ken at positive-edge dot com
New email:
PHP Version: OS:


 [2002-02-06 17:34 UTC] ken at positive-edge dot com
There is a *large* bug in the the set_content() method (as well as the new_child() method)

For instance, if i try to add a new node with content containing an entity like this, it will convert the entity to the original character.

$bugItemNode->new_child( 'title', '' );
$bugItemNode->set_content( 'HtmlTagContainer's add() method does not accept strings as an argument.' );

But when you use $doc->dumpmem(), the output will be the following:

...<title>HtmlTagContainer's add() method does not accept strings as an argument.</title>

Notice that it contains an apostrophe and it is NOT &apos;.  This is a huge bug since it does not output wellformed XML files.

Obviously, if you simply write the apostrophe character, it will do nothing to convert it to &apos; as well.  This is serious and will hinder MANY applications that need to parse the resultant XML content.  Developers, please fix this.

Ken Egervari


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-06 18:43 UTC]
This is not a bug. Please double-check the documentation available
at and the instructions on how to report
a bug at
 [2002-02-06 18:45 UTC]
Sorry. wanted to give a quick answer and not just bogusifying it. 

It's a libxml2 issue. It's not a wrong behaviour. 

for a discussion about that (and it seems, that there is no real reason, why &apos; is converted,  but it stayed this way. complain at the libxml2 people, if you want this changed)

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC