reference/xml/functions/xml-parser-set-option.xml
9acfa18973f304f8f2d531f28dd12b12c2b84f8b
9acfa18973f304f8f2d531f28dd12b12c2b84f8b
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.xml-parser-set-option">
3
+
<refentry xml:id="function.xml-parser-set-option" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>xml_parser_set_option</refname>
6
6
<refpurpose>Set options in an XML parser</refpurpose>
...
...
@@ -10,9 +10,9 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>bool</type><methodname>xml_parser_set_option</methodname>
13
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
13
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
14
14
<methodparam><type>int</type><parameter>option</parameter></methodparam>
15
-
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
15
+
<methodparam><type class="union"><type>string</type><type>int</type><type>bool</type></type><parameter>value</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
Sets an option in an XML parser.
...
...
@@ -52,13 +52,23 @@
52
52
<tbody>
53
53
<row>
54
54
<entry><constant>XML_OPTION_CASE_FOLDING</constant></entry>
55
-
<entry>integer</entry>
55
+
<entry>bool</entry>
56
56
<entry>
57
57
Controls whether <link
58
58
linkend="xml.case-folding">case-folding</link> is enabled for this
59
59
XML parser. Enabled by default.
60
60
</entry>
61
61
</row>
62
+
<row>
63
+
<entry><constant>XML_OPTION_PARSE_HUGE</constant></entry>
64
+
<entry>bool</entry>
65
+
<entry>
66
+
Allows parsing documents larger than 10 MB.
67
+
This option should only be enabled when the document size is
68
+
bounded because this could otherwise lead to a DoS.
69
+
This option is only available when using libxml2.
70
+
</entry>
71
+
</row>
62
72
<row>
63
73
<entry><constant>XML_OPTION_SKIP_TAGSTART</constant></entry>
64
74
<entry>integer</entry>
...
...
@@ -69,7 +79,7 @@
69
79
</row>
70
80
<row>
71
81
<entry><constant>XML_OPTION_SKIP_WHITE</constant></entry>
72
-
<entry>integer</entry>
82
+
<entry>bool</entry>
73
83
<entry>
74
84
Whether to skip values consisting of whitespace characters.
75
85
</entry>
...
...
@@ -106,14 +116,63 @@
106
116
<refsect1 role="returnvalues">
107
117
&reftitle.returnvalues;
108
118
<para>
109
-
This function returns &false; if <parameter>parser</parameter> does not
110
-
refer to a valid parser, or if the option could not be set. Else the
111
-
option is set and &true; is returned.
119
+
Returns &true; on success or &false; on failure.
112
120
</para>
113
121
</refsect1>
114
122
115
-
</refentry>
123
+
<refsect1 role="errors">
124
+
&reftitle.errors;
125
+
<para>
126
+
Throws a <classname>ValueError</classname> when an invalid value is passed
127
+
to <parameter>option</parameter>.
128
+
</para>
129
+
<para>
130
+
Prior to PHP 8.0.0, the function returned false when passing an invalid
131
+
value to
132
+
<parameter>option</parameter> generated a <constant>E_WARNING</constant>
133
+
as well as making the function return &false;.
134
+
</para>
135
+
</refsect1>
116
136
137
+
<refsect1 role="changelog">
138
+
&reftitle.changelog;
139
+
<informaltable>
140
+
<tgroup cols="2">
141
+
<thead>
142
+
<row>
143
+
<entry>&Version;</entry>
144
+
<entry>&Description;</entry>
145
+
</row>
146
+
</thead>
147
+
<tbody>
148
+
<row>
149
+
<entry>8.4.0</entry>
150
+
<entry>
151
+
Added the option <constant>XML_OPTION_PARSE_HUGE</constant>.
152
+
</entry>
153
+
</row>
154
+
<row>
155
+
<entry>8.3.0</entry>
156
+
<entry>
157
+
The <parameter>value</parameter> parameter now also accepts booleans.
158
+
The options <constant>XML_OPTION_CASE_FOLDING</constant> and <constant>XML_OPTION_SKIP_WHITE</constant>
159
+
are now boolean options.
160
+
</entry>
161
+
</row>
162
+
&xml.changelog.parser-param;
163
+
<row>
164
+
<entry>8.0.0</entry>
165
+
<entry>
166
+
A <classname>ValueError</classname> is now thrown if
167
+
<parameter>option</parameter> is invalid.
168
+
</entry>
169
+
</row>
170
+
</tbody>
171
+
</tgroup>
172
+
</informaltable>
173
+
</refsect1>
174
+
175
+
</refentry>
117
176
<!-- Keep this comment at the end of the file
118
177
Local variables:
119
178
mode: sgml
120
179