php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35673 formatOutput does not work with saveHTML
Submitted: 2005-12-14 23:16 UTC Modified: 2006-08-28 19:54 UTC
Votes:5
Avg. Score:4.6 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:1 (25.0%)
From: ken at smallboxsoftware dot net Assigned: rrichards (profile)
Status: Closed Package: DOM XML related
PHP Version: 6CVS, 5CVS OS: Linux
Private report: No CVE-ID: None
 [2005-12-14 23:16 UTC] ken at smallboxsoftware dot net
Description:
------------
saveHTML does not appear to format output. I assume it is supposed to because the manual entry for this function shows ->formatOutput = true


From the C code for the function:
        DOM_GET_OBJ(docp, id, xmlDocPtr, intern);

        htmlDocDumpMemory(docp, &mem, &size);

as opposed for the C function for saveHTMLFile which does appear to format output: 

   DOM_GET_OBJ(docp, id, xmlDocPtr, intern);

        /* encoding handled by property on doc */

    doc_props = dom_get_doc_props(intern->document);
    format = doc_props->formatoutput;
    bytes = htmlSaveFileFormat(file, docp, NULL, format);

 



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-15 01:02 UTC] rrichards@php.net
Will fix once suitable api exists in libxml2 for this. currently only works when saving to file without duplicating all the routines needed.
 [2005-12-15 07:26 UTC] ken at smallboxsoftware dot net
Would libxml function htmlNodeDumpFormatOutput not suffice in this case?
 [2005-12-15 12:20 UTC] rrichards@php.net
not without re-creating the code for encoding and handling the output buffer and the function would then call htmlDocContentDumpFormatOutput. Not worth this just to disable the formatting for a string (right now it always formats output for saveHTML). i will just add the appropriate functionality in libxml2.

if you really need it disabled you can always write a custom stream handler that concats the output to a string and use it with saveHTMLFile.
 [2006-08-28 19:54 UTC] rrichards@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

implemented in HEAD when using libxml2-2.6.23+
 [2010-04-02 18:15 UTC] rrichards@php.net
Automatic comment from SVN on behalf of rrichards
Revision: http://svn.php.net/viewvc/?view=revision&revision=297342
Log: re-apply bug fix #35673 (formatOutput does not work with saveHTML) from old trunk
add test
BFN
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 02:01:30 2024 UTC