PHP Function Reference

PHP libxml_disable_entity_loader() Function



The PHP libxml_disable_entity_loader() function disables/enables the ability to load external entities. Disabling the loading of external entities may cause general issues with loading XML documents. However, as of libxml 2.9.0 entity substitution is disabled by default, so there is no need to disable the loading of external entities, unless there is the need to resolve internal entity references with LIBXML_NOENT. Generally, it is preferable to use libxml_set_external_entity_loader() to suppress loading of external entities.

Note: This function has been DEPRECATED as of PHP 8.0.0.

Syntax

libxml_disable_entity_loader(disable)

Parameters

disable Optional. Disable (true) or enable (false) libxml extensions (such as DOM, XMLWriter and XMLReader) to load external entities. Default is true.

Return Value

Returns the previous value.

Example: libxml_disable_entity_loader() example

The example below shows the usage of libxml_disable_entity_loader() function.

<?php
libxml_disable_entity_loader(false)
?>

❮ PHP Libxml Reference