1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00

fix bug #50661 (DOMDocument::loadXML does not allow UTF-16)

add test
This commit is contained in:
Rob Richards
2010-01-06 13:13:17 +00:00
parent d5b2007bed
commit bc1feb9034
3 changed files with 20 additions and 3 deletions
+1
View File
@@ -8,6 +8,7 @@ PHP NEWS
(Ilia)
- Added stream_resolve_include_path(). (Mikko)
- Fixed bug #50661 (DOMDocument::loadXML does not allow UTF-16). (Rob)
- Fixed bug #50657 (copy() with an empty (zero-byte) HTTP source succeeds
but returns false). (Ilia)
- Fixed bug #50636 (MySQLi_Result sets values before calling constructor).
+3 -3
View File
@@ -1542,7 +1542,7 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p
}
/* }}} */
static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int options TSRMLS_DC) /* {{{ */
static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int source_len, int options TSRMLS_DC) /* {{{ */
{
xmlDocPtr ret;
xmlParserCtxtPtr ctxt = NULL;
@@ -1579,7 +1579,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int optio
}
} else {
ctxt = xmlCreateDocParserCtxt(source);
ctxt = xmlCreateMemoryParserCtxt(source, source_len);
}
if (ctxt == NULL) {
@@ -1682,7 +1682,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
RETURN_FALSE;
}
newdoc = dom_document_parser(id, mode, source, options TSRMLS_CC);
newdoc = dom_document_parser(id, mode, source, source_len, options TSRMLS_CC);
if (!newdoc)
RETURN_FALSE;
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #50661 (DOMDocument::loadXML does not allow UTF-16).
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$data = "\xFE\xFF\x00\x3C\x00\x66\x00\x6F\x00\x6F\x00\x2F\x00\x3E";
$dom = new DOMDocument();
$dom->loadXML($data);
echo $dom->saveXML();
?>
--EXPECT--
<?xml version="1.0"?>
<foo/>