#48509 [Opn->Asn]: formatOutput does not work with saveHTML
| From: | chregu@php.net | Date: | Wed, 10 Jun 2009 06:49:31 +0000 |
| Subject: | #48509 [Opn->Asn]: formatOutput does not work with saveHTML | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138157@lists.php.net to get a copy of this message | ||
ID: 48509
Updated by: chregu@php.net
Reported By: knut@php.net
-Status: Open
+Status: Assigned
Bug Type: DOM XML related
Operating System: Mac OS X 10.5.7
PHP Version: 5.3CVS-2009-06-09 (CVS)
-Assigned To:
+Assigned To: chregu
New Comment:
RIght, that never was backported to the 5_3 branch. But we're currently
in a commit freeze, so I can't check it in, but will as soon as I am
allowed to do it.
That's the patch by the way:
http://cvs.php.net/viewvc.cgi/php-src/ext/dom/document.c?
r1=1.78&r2=1.79&pathrev=MAIN&view=patch
Previous Comments:
------------------------------------------------------------------------
[2009-06-09 16:51:53] knut@php.net
Description:
------------
While writing test cases on Oslo TestFest 2009 I just found that the
$dom->formatOutput does not work with $dom->saveHTML() (even though it
seems to have been resolved here: http://bugs.php.net/bug.php?id=35673)
xmllint says:
$ xmllint --format --html output.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>This is the title</title>
</head></html>
so according to Hannes here this seems to be a bug in PHP 5.3 (may be
that it's fixed i HEAD but not backported?).
Reproduce code:
---------------
<?php
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
$head = $doc->createElement('head');
$head = $root->appendChild($head);
$title = $doc->createElement('title');
$title = $head->appendChild($title);
$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
echo $doc->saveHTML();
?>
Expected result:
----------------
<html>
<head>
<title>This is the title</title>
</head>
</html>
Actual result:
--------------
<html><head><title>This is the title</title></head></html>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48509&edit=1