Fix external entity loader #89
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 whenext_ent_handlerhas been passed in a previous parser instantiation -t/49global_private_extent.tno_networkhas been passed in a previous parser instantiation -t/49global_extend_after_no_network.texternEntityLoaderit is not possible to clear it: setting it toundefLibXML_load_external_entityinstalled, which e.g. does not checkno_network-t49/global_extent_reset.text_ent_handlerpassed to a later parser instantiation -t49/global_private_extent.ttest 4externalEntityLoadersometimes causes a segfault (at least in some cases when the return value is used)and would suggest this PR as a solution:
externalEntityLoaderandext_ent_handlerindependent, including their storage of 'old handler', withexternalEntityLoaderoverridingext_ent_handlerlike nowexternalEntityLoader(undef)as 'fully undo settingexternalEntityLoader'&PL_sv_undefinstead ofNULLwhen no handler was previously setThanks for XML::LibXML!