From fdbc42611c9997fdcd875c21b17c74a5b0c57362 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Wed, 19 Jan 2011 00:22:06 +0000 Subject: [PATCH] - Hopefully finally fixed the mess in rev 307562 and rev 307563. --- ext/dom/document.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ext/dom/document.c b/ext/dom/document.c index 684bb3c83f..2d7df36d73 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1821,7 +1821,7 @@ PHP_FUNCTION(dom_document_savexml) saveempty = xmlSaveNoEmptyTags; xmlSaveNoEmptyTags = 1; } - htmlNodeDumpFormatOutput(buf, docp, node, 0, format); + xmlNodeDump(buf, docp, node, 0, format); if (options & LIBXML_SAVE_NOEMPTYTAG) { xmlSaveNoEmptyTags = saveempty; } @@ -2318,12 +2318,17 @@ PHP_FUNCTION(dom_document_save_html) RETURN_FALSE; } - xmlNodeDump(buf, docp, node, 0, format); - mem = (xmlChar*) xmlBufferContent(buf); - if (!mem) { - RETVAL_FALSE; + size = htmlNodeDump(buf, docp, node); + if (size >= 0) { + mem = (xmlChar*) xmlBufferContent(buf); + if (!mem) { + RETVAL_FALSE; + } else { + RETVAL_STRINGL((const char*) mem, size, 1); + } } else { - RETVAL_STRING(mem, 1); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error dumping HTML node"); + RETVAL_FALSE; } xmlBufferFree(buf); } else { @@ -2335,7 +2340,7 @@ PHP_FUNCTION(dom_document_save_html) if (!size) { RETVAL_FALSE; } else { - RETVAL_STRINGL(mem, size, 1); + RETVAL_STRINGL((const char*) mem, size, 1); } if (mem) xmlFree(mem); -- 2.50.1