From: Operating system: RHEL 6 PHP version: Irrelevant Package: DOM XML related Bug Type: Bug Bug description:createcdatasection and ASCII \x10
Description: ------------ DOMDocument::createCdataSection is leaving ascii control character \x10 which makes the resulting xml invalid. It seems like this character should be handled by the function. Otherwise it ahs to be escaped with: $dom->createCDATASection(preg_replace('/[\x10]/', '', $value)); Test script: --------------- header("Content-type: application/xml; charset=UTF-8"); $dom = new DOMDocument('1.0', 'UTF-8'); $e = $dom->createElement('element'); $dom->appendChild($e); $e->appendChild($dom->createCDATASection("something\x10something")); print $dom->saveXml(); exit(); Expected result: ---------------- I would expect clean xml. Actual result: -------------- Attempting to read it with DomDocument gives: DOMDocument::loadXML() [<a href='domdocument.loadxml'>domdocument.loadxml</a>]: CData section not finished Opening the above script in chrome gives: This page contains the following errors: error on line 2 at column 19: Input is not proper UTF-8, indicate encoding ! Bytes: 0x10 0x73 0x6F 0x6D -- Edit bug report at https://bugs.php.net/bug.php?id=60463&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60463&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60463&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60463&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60463&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60463&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60463&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60463&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60463&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60463&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60463&r=support Expected behavior: https://bugs.php.net/fix.php?id=60463&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60463&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60463&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60463&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60463&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60463&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60463&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60463&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60463&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60463&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60463&r=mysqlcfg