go to bug id or search bugs for
There is no way at the moment to retrieve the callback currently in use by libxml2's entity loader.
Imagine an application uses XML and has defined an entity loader.
Now, that application relies on an external library which also uses XML and relies on its own entity loader.
When the library is called, it will overwrite the application's entity loader with no way to restore it afterward.
I suggest changing the return value of libxml_set_external_entity_loader() so that it returns the previous entity loader if one was registered or NULL if no entity loader has been registered yet. It would also return NULL for errors.
This would match the behavior of other PHP functions like set_error_handler() and set_exception_handler().
Alternatively, being able to define multiple (stacking) entity loaders or having a function to restore the previous entity loader would be fine too.
Add a Patch
Add a Pull Request