Skip to content

Document XML_OPTION_PARSE_HUGE #3899

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

Merged
merged 2 commits into from
Oct 23, 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/xml/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,19 @@
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.xml-option-parse-huge">
<term>
<constant>XML_OPTION_PARSE_HUGE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Available as of PHP 8.4.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea whether libexpat is still properly supported, but if it is, we should clarify here (or maybe below) that the constant is only relevant for libxml2. I'm also not sure whether PHP 7.0 still supported libxml2 < 2.7.0, and if so, what would happen there (would basically XML_OPTION_PARSE_HUGE be enabled by default, and could not be disabled?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right; why does it have to be so complex :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked, PHP 7 supports libxml2 2.6.11

When libxml2 &lt; 2.7.0 is used (e.g. on PHP 7.x),
this option is enabled by default and cannot be disabled.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.xml-option-target-encoding">
<term>
<constant>XML_OPTION_TARGET_ENCODING</constant>
Expand Down
1 change: 1 addition & 0 deletions reference/xml/functions/xml-parser-get-option.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<listitem>
<simpara>
Which option to fetch. <constant>XML_OPTION_CASE_FOLDING</constant>,
<constant>XML_OPTION_PARSE_HUGE</constant>,
<constant>XML_OPTION_SKIP_TAGSTART</constant>, <constant>XML_OPTION_SKIP_WHITE</constant>
and <constant>XML_OPTION_TARGET_ENCODING</constant> are available.
See <function>xml_parser_set_option</function> for their description.
Expand Down
16 changes: 16 additions & 0 deletions reference/xml/functions/xml-parser-set-option.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@
XML parser. Enabled by default.
</entry>
</row>
<row>
<entry><constant>XML_OPTION_PARSE_HUGE</constant></entry>
<entry>bool</entry>
<entry>
Allows parsing documents larger than 10 MB.
This option should only be enabled when the document size is
bounded because this could otherwise lead to a DoS.
This option is only available when using libxml2.
</entry>
</row>
<row>
<entry><constant>XML_OPTION_SKIP_TAGSTART</constant></entry>
<entry>integer</entry>
Expand Down Expand Up @@ -135,6 +145,12 @@
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Added the option <constant>XML_OPTION_PARSE_HUGE</constant>.
</entry>
</row>
<row>
<entry>8.3.0</entry>
<entry>
Expand Down