From: Rob Richards Date: Fri, 2 Apr 2010 16:15:06 +0000 (+0000) Subject: re-apply bug fix #35673 (formatOutput does not work with saveHTML) from old trunk X-Git-Tag: php-5.3.3RC1~346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12b71200beb41c6e2706b2ae442b5694f5c91675;p=php re-apply bug fix #35673 (formatOutput does not work with saveHTML) from old trunk add test BFN --- diff --git a/NEWS b/NEWS index 326830246f..013528da47 100644 --- a/NEWS +++ b/NEWS @@ -56,7 +56,7 @@ PHP NEWS (yoarvi@gmail.com, Derick) - Fixed bug #48902 (Timezone database fallback map is outdated). (Derick) - Fixed bug #46111 (Some timezone identifiers can not be parsed). (Derick) - +- Fixed bug #35673 (formatOutput does not work with saveHTML). (Rob) ?? ??? 20??, PHP 5.3.2 - Upgraded bundled sqlite to version 3.6.22. (Ilia) diff --git a/ext/dom/document.c b/ext/dom/document.c index 8b212ed03e..5b8e3c6efa 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -2286,7 +2286,8 @@ PHP_FUNCTION(dom_document_save_html) xmlDoc *docp; dom_object *intern; xmlChar *mem; - int size; + int size, format; + dom_doc_propsptr doc_props; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &id, dom_document_class_entry) == FAILURE) { return; @@ -2294,7 +2295,13 @@ PHP_FUNCTION(dom_document_save_html) DOM_GET_OBJ(docp, id, xmlDocPtr, intern); +#if LIBXML_VERSION >= 20623 + doc_props = dom_get_doc_props(intern->document); + format = doc_props->formatoutput; + htmlDocDumpMemoryFormat(docp, &mem, &size, format); +#else htmlDocDumpMemory(docp, &mem, &size); +#endif if (!size) { if (mem) xmlFree(mem); diff --git a/ext/dom/tests/bug35673.phpt b/ext/dom/tests/bug35673.phpt new file mode 100644 index 0000000000..a29ae96b64 --- /dev/null +++ b/ext/dom/tests/bug35673.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #35673 (formatOutput does not work with saveHTML). +--SKIPIF-- + +--FILE-- + +This is the title'; + +$htmldoc = new DOMDocument(); +$htmldoc->loadHTML($html); +$htmldoc->formatOutput = true; +echo $htmldoc->saveHTML(); +?> +--EXPECT-- + + + +This is the title +