mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
- Hopefully finally fixed the mess in rev 307562 and rev 307563.
This commit is contained in:
parent
95388b7cda
commit
b9b1fb1827
@ -2318,12 +2318,17 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
htmlNodeDumpFormatOutput(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);
|
||||
|
26
ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
Normal file
26
ext/dom/tests/DOMDocument_saveHTML_variant2.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
DOMDocument::saveHTML() vs DOMDocumet::saveXML()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once dirname(__FILE__) .'/skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$d = new DOMDocument();
|
||||
$str = <<<EOD
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<p>Hi.<br/>there</p>
|
||||
</body>
|
||||
</html>
|
||||
EOD;
|
||||
$d->loadHTML($str);
|
||||
$e = $d->getElementsByTagName("p");
|
||||
$e = $e->item(0);
|
||||
echo $d->saveXml($e),"\n";
|
||||
echo $d->saveHtml($e),"\n";
|
||||
--EXPECTF--
|
||||
<p>Hi.<br/>there</p>
|
||||
<p>Hi.<br>there</p>
|
Loading…
Reference in New Issue
Block a user