Bug #54214 [Opn->Bgs]: DOMDocument::createTextNode allows low ascii without exception

From: Date: Fri, 11 Mar 2011 03:47:54 +0000
Subject: Bug #54214 [Opn->Bgs]: DOMDocument::createTextNode allows low ascii without exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159383@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54214&edit=1

 ID:                 54214
 Updated by:         aharvey@php.net
 Reported by:        trenjeska+php at gmail dot com
 Summary:            DOMDocument::createTextNode allows low ascii without
                     exception
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            DOM XML related
 Operating System:   windows server
 PHP Version:        5.2.17
 Block user comment: N
 Private report:     N

 New Comment:

The XML specification defines the list of valid characters thusly:

Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

In theory, therefore, 0x06 actually falls into that range.

In practice, what happens is that restricted characters can't be
serialised by libxml, so while you can create the DOMText object
(correctly), you'll get a warning on output:

Warning: DOMDocument::saveXML(): xmlEscapeEntities : char out of range
in /tmp/test.php on line 9

This seems reasonable to me -- you still get a warning, just at a
different point.

Closing.


Previous Comments:
------------------------------------------------------------------------
[2011-03-10 17:59:13] trenjeska+php at gmail dot com

Description:
------------
---
From manual page:
http://nl3.php.net/manual/en/domdocument.createtextnode.php
---
createtextnode still returns the DOMText if there is low-ascii in the
string.
It should return false. DOMDocument is there to be used to make sure you
output well-formed xml. Now it silently creates invalid xml, even though
the proper functions have been used.
MSXML _does_ except at this point.

Test script:
---------------
.createTextNode("Mensje Francina")

There is a low ascii (0x06) in front of the "F" in there for copy-paste
pleasures

Expected result:
----------------
FALSE

Actual result:
--------------
DOMText node


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



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


Thread (2 messages)

« previous php.bugs (#159383) next »