From 6feb1edcb6b0b211fc20caf4325cbfadbdbe4bd7 Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Fri, 2 Apr 2010 16:15:06 +0000 Subject: [PATCH] re-apply bug fix #35673 (formatOutput does not work with saveHTML) from old trunk add test BFN --- ext/dom/document.c | 9 ++++++++- ext/dom/tests/bug35673.phpt | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ext/dom/tests/bug35673.phpt 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 + -- 2.50.1