From ce0b3dec4c70670449e1add99ab23375087f5dde Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Fri, 5 Dec 2003 01:16:16 +0000 Subject: [PATCH] Fixed bug #26528 (HTML entities are not being decoded by xml_parse()/xml_parse_into_struct()). --- NEWS | 2 ++ ext/xml/compat.c | 1 + ext/xml/tests/bug26528.phpt | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 ext/xml/tests/bug26528.phpt diff --git a/NEWS b/NEWS index 39fa846da5..d77deb18d4 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ PHP NEWS - Fixed include_once() / require_once() on Windows to honor case-insensitivity of files. (Andi) - Fixed __autoload() to preserve case of the passed class name. (Andi) +- Fixed bug #26528 (HTML entities are not being decoded by + xml_parse()/xml_parse_into_struct()). (Ilia) - Fixed bug #26072 (--disable-libxml does not work). (Jani) - Fixed bug #26083 (Non-working write support in ext/dom). (Ilia) - Fixed bug #26001 (serialize crashes when accessing an overloaded object that diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 6a40be8497..5b878fa269 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -412,6 +412,7 @@ XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *m } else { parser->parser->charset = XML_CHAR_ENCODING_NONE; } + parser->parser->replaceEntities=1; if (sep != NULL) { parser->use_namespace = 1; parser->_ns_map = xmlHashCreate(10); diff --git a/ext/xml/tests/bug26528.phpt b/ext/xml/tests/bug26528.phpt new file mode 100644 index 0000000000..2fa015a84d --- /dev/null +++ b/ext/xml/tests/bug26528.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #26528 (HTML entities are not being decoded) +--FILE-- +"; + $parser = xml_parser_create(); + $res = xml_parse_into_struct($parser,$sample,$vals,$index); + xml_parser_free($parser); + var_dump($vals); +?> +--EXPECT-- +array(1) { + [0]=> + array(4) { + ["tag"]=> + string(4) "TEST" + ["type"]=> + string(8) "complete" + ["level"]=> + int(1) + ["attributes"]=> + array(1) { + ["ATTR"]=> + string(13) "angle