diff options
author | Rob Richards <rrichards@php.net> | 2004-11-21 14:25:15 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2004-11-21 14:25:15 +0000 |
commit | a7cd9768d191150d366b61a3fae08736f1022986 (patch) | |
tree | db6ea1cce619b5808942f507f890dad23d433a5e /ext/xml/compat.c | |
parent | 39b25e4f3d6662219a00ffd17336dda7fb9919ae (diff) | |
download | php-git-a7cd9768d191150d366b61a3fae08736f1022986.tar.gz |
internal entities get expanded if no default handler but cdata handler exists
Diffstat (limited to 'ext/xml/compat.c')
-rw-r--r-- | ext/xml/compat.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 72a9b4ed01..e0d7f08bd7 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -278,7 +278,6 @@ _get_entity(void *user, const xmlChar *name) if (ret == NULL) ret = xmlGetDocEntity(parser->parser->myDoc, name); - if (ret == NULL || (parser->parser->instate != XML_PARSER_ENTITY_VALUE && parser->parser->instate != XML_PARSER_ATTRIBUTE_VALUE)) { if (ret == NULL || ret->etype == XML_INTERNAL_GENERAL_ENTITY || ret->etype == XML_INTERNAL_PARAMETER_ENTITY || ret->etype == XML_INTERNAL_PREDEFINED_ENTITY) { if (parser->h_default) { @@ -288,6 +287,12 @@ _get_entity(void *user, const xmlChar *name) _build_entity(name, xmlStrlen(name), &entity, &len); parser->h_default(parser->user, (const xmlChar *) entity, len); xmlFree(entity); + } else { + /* expat will not expand internal entities if default handler is present otherwise + it will expand and pass them to cdata handler */ + if (parser->h_cdata && ret) { + parser->h_cdata(parser->user, ret->content, xmlStrlen(ret->content)); + } } } else { if (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { |