php.net |  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
Votes:2
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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gregoire dot berclaz at students dot hevs dot ch
New email:
PHP Version: OS:

 

 [2008-10-21 07:44 UTC] gregoire dot berclaz at students dot hevs dot ch
Description:
------------
The function addAttribute convert html entities like "é" => "é"

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

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

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-21 10:33 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

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: Sat Dec 07 06:01:28 2024 UTC