Skip to content

Commit 23874f3

Browse files
committed
Stop reading parse state directly
This check is no longer necessary from libxml2 2.14, and these members are deprecated too.
1 parent fc5a6b2 commit 23874f3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/xml/compat.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,11 @@ _get_entity(void *user, const xmlChar *name)
375375
if (ret == NULL)
376376
ret = xmlGetDocEntity(parser->parser->myDoc, name);
377377

378-
if (ret == NULL || (parser->parser->instate != XML_PARSER_ENTITY_VALUE && parser->parser->instate != XML_PARSER_ATTRIBUTE_VALUE)) {
378+
/* At least libxml2 >= 2.14 no longer sets these states, so starting with that version the first if is always true. */
379+
#if LIBXML_VERSION < 21400
380+
if (ret == NULL || (parser->parser->instate != XML_PARSER_ENTITY_VALUE && parser->parser->instate != XML_PARSER_ATTRIBUTE_VALUE))
381+
#endif
382+
{
379383
if (ret == NULL || ret->etype == XML_INTERNAL_GENERAL_ENTITY || ret->etype == XML_INTERNAL_PARAMETER_ENTITY || ret->etype == XML_INTERNAL_PREDEFINED_ENTITY) {
380384
/* Predefined entities will expand unless no cdata handler is present */
381385
if (parser->h_default && ! (ret && ret->etype == XML_INTERNAL_PREDEFINED_ENTITY && parser->h_cdata)) {

0 commit comments

Comments
 (0)