--- embedaddon/php/ext/dom/document.c 2013/07/22 01:31:40 1.1.1.3 +++ embedaddon/php/ext/dom/document.c 2014/06/15 20:03:42 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: document.c,v 1.1.1.3 2013/07/22 01:31:40 misho Exp $ */ +/* $Id: document.c,v 1.1.1.4 2014/06/15 20:03:42 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1509,6 +1509,12 @@ char *_dom_get_valid_file_path(char *source, char *res if (uri->scheme != NULL) { /* absolute file uris - libxml only supports localhost or empty host */ +#ifdef PHP_WIN32 + if (strncasecmp(source, "file://",7) == 0 && ':' == source[8]) { + isFileUri = 1; + source += 7; + } else +#endif if (strncasecmp(source, "file:///",8) == 0) { isFileUri = 1; #ifdef PHP_WIN32 @@ -2296,7 +2302,7 @@ PHP_FUNCTION(dom_document_save_html) xmlBufferPtr buf; dom_object *intern, *nodeobj; xmlChar *mem = NULL; - int size, format; + int size = 0, format; dom_doc_propsptr doc_props; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), @@ -2324,7 +2330,22 @@ PHP_FUNCTION(dom_document_save_html) RETURN_FALSE; } - size = htmlNodeDump(buf, docp, node); + if (node->type == XML_DOCUMENT_FRAG_NODE) { + int one_size; + + for (node = node->children; node; node = node->next) { + one_size = htmlNodeDump(buf, docp, node); + + if (one_size >= 0) { + size += one_size; + } else { + size = -1; + break; + } + } + } else { + size = htmlNodeDump(buf, docp, node); + } if (size >= 0) { mem = (xmlChar*) xmlBufferContent(buf); if (!mem) {