#46352 [Opn->Bgs]: addAttribute and HTML entities

From: Date: Tue, 21 Oct 2008 10:33:44 +0000
Subject: #46352 [Opn->Bgs]: addAttribute and HTML entities
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129922@lists.php.net to get a copy of this message
 ID:               46352
 Updated by:       rrichards@php.net
 Reported By:      gregoire dot berclaz at students dot hevs dot ch
-Status:           Open
+Status:           Bogus
 Bug Type:         SimpleXML related
 Operating System: Windows
 PHP Version:      5.2.6
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2008-10-21 07:44:52] 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>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46352&edit=1



Thread (2 messages)

« previous php.bugs (#129922) next »