Req #76763 [PATCH]: Make libxml_set_external_entity_loader() return previous entity loader
| From: | tstarling@php.net | Date: | Fri, 21 Jan 2022 04:50:44 +0000 |
| Subject: | Req #76763 [PATCH]: Make libxml_set_external_entity_loader() return previous entity loader | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-239162@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76763&edit=1
ID: 76763
Patch added by: tstarling@php.net
Reported by: clicky at erebot dot net
Summary: Make libxml_set_external_entity_loader() return
previous entity loader
Status: Open
Type: Feature/Change Request
Package: XML related
Operating System: Debian 9
PHP Version: 7.2.9
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Make libxml_set_external_entity_loader() return the previous loader
On GitHub: https://github.com/php/php-src/pull/7977
Patch: https://github.com/php/php-src/pull/7977.patch
Previous Comments:
------------------------------------------------------------------------
[2021-08-19 14:19:33] cmb@php.net
That looks like a reasonable request. A respective PR would
likely be welcome.
[1] <https://github.com/php/php-src/pulls>
------------------------------------------------------------------------
[2018-08-18 10:14:29] clicky at erebot dot net
Description:
------------
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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76763&edit=1