|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46352 addAttribute and HTML entities
Submitted: 2008-10-21 07:44 UTC Modified: 2008-10-21 10:33 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: gregoire dot berclaz at students dot hevs dot ch Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.2.6 OS: Windows
Private report: No CVE-ID: None
 [2008-10-21 07:44 UTC] gregoire dot berclaz at students dot hevs dot ch
The function addAttribute convert html entities like "é" => "é"

Reproduce code:
$simpleXml = simplexml_load_string("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><!DOCTYPE dtdsite SYSTEM \"\"><xml></xml>", null, LIBXML_DTDLOAD);
		$config = $simpleXml->addChild("config", "&eacute;");
		$config->addAttribute("langue", "&eacute;");

Expected result:
	<config langue="&eacute;">&eacute;</config>

Actual result:
	<config langue="&amp;eacute;">&eacute;</config>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-21 10:33 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

You need to use DOM for the more complex functionality due to attribute 
escaping rules.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 00:01:28 2024 UTC