#40105 [Opn]: DOMDocument->createElement() unescapes numeric character references in values

From: Date: Thu, 11 Jan 2007 23:28:31 +0000
Subject: #40105 [Opn]: DOMDocument->createElement() unescapes numeric character references in values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107508@lists.php.net to get a copy of this message
ID: 40105 User updated by: fletch at pobox dot com Reported By: fletch at pobox dot com Status: Open Bug Type: DOM XML related Operating System: linux PHP Version: 5.2.0 New Comment: There's a trivial error in the expected result text: the string length produced by var_dump() should be 65, not 59. Previous Comments: ------------------------------------------------------------------------ [2007-01-11 23:26:27] fletch at pobox dot com Description: ------------ DOMDocument->createElement() unescapes any numeric character references (NCRs) contained in the value passed to its optional second parameter. It should preserve the value as passed. Reproduce code: --------------- <?php $dom = new DOMDocument( "1.0", 'UTF-8' ); $dom->appendChild( $dom->createElement( 'root', '&amp;&#0160;' ) ); var_dump( trim( $dom->saveXML() ) ); ?> Expected result: ---------------- string(59) "<?xml version="1.0" encoding="UTF-8"?> <root>&amp;&#0160;</root>" Actual result: -------------- string(59) "<?xml version="1.0" encoding="UTF-8"?> <root>&amp; </root>" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40105&edit=1

« previous php.bugs (#107508) next »