From: Operating system: Irrelevant PHP version: 5.3.6 Package: DOM XML related Bug Type: Bug Bug description:DOMDocument->formatOutput = true does not work when textnodes or cdata are used
Description: ------------ hi, $doc = new \DOMDocument("1.0","UTF-8"); $doc->formatOutput = true; $doc->appendChild($root = $doc->createElement("root")); $root->appendChild($doc->createElement("sub")); $root->appendChild($doc->createElement("sub")); $root->appendChild($doc->createElement("sub")); // uncomment one or both following line(s): //$root->appendChild($doc->createTextNode("text")); //$root->appendChild($doc->createCDATASection("text")); $root->appendChild($doc->createElement("sub")); $root->appendChild($doc->createElement("sub")); echo "<xmp>"; echo $doc->saveXML(); echo "</xmp>"; -- Edit bug report at http://bugs.php.net/bug.php?id=54972&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54972&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54972&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54972&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54972&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54972&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54972&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54972&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54972&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54972&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54972&r=support Expected behavior: http://bugs.php.net/fix.php?id=54972&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54972&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54972&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54972&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54972&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54972&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54972&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54972&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54972&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54972&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54972&r=mysqlcfg