#31191 [Opn->WFx]: "unterminated entity reference" when using the value parameter to createElement
| From: | chregu@php.net | Date: | Mon, 20 Dec 2004 07:10:53 +0000 |
| Subject: | #31191 [Opn->WFx]: "unterminated entity reference" when using the value parameter to createElement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70664@lists.php.net to get a copy of this message | ||
ID: 31191
Updated by: chregu@php.net
Reported By: php at owenpshaw dot net
-Status: Open
+Status: Wont fix
Bug Type: DOM XML related
Operating System: Linux
PHP Version: 5.0.3
New Comment:
We discussed that topic (internally) and we decided not to implement
escaping here. If I remember correctly, one of the reason was for
backwards compatibility, as we discovered this after 5.0.0 was
released.
Use $doc->createTextNode() if you want to have automatic escaping
Previous Comments:
------------------------------------------------------------------------
[2004-12-20 06:46:15] php at owenpshaw dot net
Description:
------------
It looks like no escaping is done to the optional "value" parameter in
the DomDocument::createElement() and DomDocument::createElementNS().
The online documentation doesn't specify what the correct behavior
should be, and it's not part of the DOM standard, so it seems possible
that this is a bug.
Reproduce code:
---------------
$document = new DomDocument();
$element = $document->createElement('foo','&');
Expected result:
----------------
I would expect the '&' (or any other character that should be escaped)
to be escaped as if I had used DomDocument::createTextNode().
Actual result:
--------------
Warning: unterminated entity reference in [FILE] on line [LINE]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31191&edit=1