Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GH-1408: Deprecation of libxml_disable_entity_loader() should warn about constants which will override the new default behaviour #4036

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions reference/libxml/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
<simpara>
Default DTD attributes
</simpara>
<caution>
<simpara>
Enabling loading of DTD attributes will enable fetching of external entities.
The <constant>LIBXML_NO_XXE</constant> constant can be used to prevent this (only available in Libxml &gt;= 2.13.0, as of PHP 8.4.0).
</simpara>
</caution>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.libxml-dtdload">
Expand All @@ -57,6 +63,12 @@
<simpara>
Load the external subset
</simpara>
<caution>
<simpara>
Enabling loading of external subsets will enable fetching of external entities.
The <constant>LIBXML_NO_XXE</constant> constant can be used to prevent this (only available in Libxml &gt;= 2.13.0, as of PHP 8.4.0).
</simpara>
</caution>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.libxml-dtdvalid">
Expand All @@ -71,6 +83,7 @@
<caution>
<simpara>
Enabling validating the DTD may facilitate XML External Entity (XXE) attacks.
The <constant>LIBXML_NO_XXE</constant> constant can be used to prevent this (only available in Libxml &gt;= 2.13.0, as of PHP 8.4.0).
</simpara>
</caution>
</listitem>
Expand Down
13 changes: 10 additions & 3 deletions reference/libxml/functions/libxml-disable-entity-loader.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
<para>
Disable/enable the ability to load external entities.
Note that disabling the loading of external entities may cause general issues
with loading XML documents. However, as of libxml 2.9.0 entity substitution
with loading XML documents.
</para>
<para>
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 <constant>LIBXML_NOENT</constant>.
unless there is the need to resolve internal entity references with <constant>LIBXML_NOENT</constant>,
<constant>LIBXML_DTDVALID</constant>, or <constant>LIBXML_DTDLOAD</constant>.
Generally, it is preferable to use <function>libxml_set_external_entity_loader</function>
to suppress loading of external entities.
The <constant>LIBXML_NO_XXE</constant> constant can be used to prevent this as well (only available in Libxml &gt;= 2.13.0, as of PHP 8.4.0).
</para>
</refsect1>

Expand Down Expand Up @@ -99,7 +104,9 @@
<simplelist>
<member><function>libxml_use_internal_errors</function></member>
<member><function>libxml_set_external_entity_loader</function></member>
<member><link linkend="libxml.constants">The <constant>LIBXML_NOENT</constant> constant</link></member>
<member>The <constant>LIBXML_NOENT</constant> constant</member>
<member>The <constant>LIBXML_DTDVALID</constant> constant</member>
<member>The <constant>LIBXML_NO_XXE</constant> constant</member>
</simplelist>
</para>
</refsect1>
Expand Down