libxml_set_external_entity_loader
PHP 5 >= 5.4.0, PHP 7, PHP 8
libxml_set_external_entity_loader - Changes the default external entity loader
Manual
libxml_set_external_entity_loader(
callable|null$resolver_function ): bool
Changes the default external entity loader. This can be used to suppress the expansion of arbitrary external entities to avoid XXE attacks, even when LIBXML_NOENT has been set for the respective operation, and is usually preferable over calling libxml_disable_entity_loader.
Parameters
- resolver_function
-
A callable with the following signature:
resolver( string$public_id, string$system_id, array$context ): resource|string|null- public_id
-
The public ID.
- system_id
-
The system ID.
- context
-
An array with the four elements "directory", "intSubName", "extSubURI" and "extSubSystem".
Return Values
Returns true on success or false on failure.