Skip to content

Conversation

@robb2040
Copy link

I found the following issues with externalEntityLoader(...) when trying to use it for a single XML Schema parse without affecting later other parses:

  • externalEntityLoader(...) does not take effect when
    • ext_ent_handler has been passed in a previous parser instantiation - t/49global_private_extent.t
    • no_network has been passed in a previous parser instantiation - t/49global_extend_after_no_network.t
  • after calling externEntityLoader it is not possible to clear it: setting it to undef
    • still keeps LibXML_load_external_entity installed, which e.g. does not check no_network - t49/global_extent_reset.t
    • still hides an ext_ent_handler passed to a later parser instantiation - t49/global_private_extent.t test 4
  • the first call to externalEntityLoader sometimes causes a segfault (at least in some cases when the return value is used)

and would suggest this PR as a solution:

  • Make externalEntityLoader and ext_ent_handler independent, including their storage of 'old handler', with externalEntityLoader overriding ext_ent_handler like now
  • Interpret externalEntityLoader(undef) as 'fully undo setting externalEntityLoader'
  • Return &PL_sv_undef instead of NULL when no handler was previously set

Thanks for XML::LibXML!

- global externalEntityLoader and private ext_ent_handler can now be set
  independent of each other, with externalEntityLoader taking precedence
  upon actual resolve
- externalEntityLoader(undef) now fully clears the global
  externalEntityLoader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant