-
Notifications
You must be signed in to change notification settings - Fork 767
/
Copy pathconstants.xml
406 lines (402 loc) · 11 KB
/
constants.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="json.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&extension.constants;
<para>
The following constants indicate the type of error returned by
<function>json_last_error</function> or stored as the <varname>code</varname>
of a <classname>JsonException</classname>.
</para>
<variablelist>
<varlistentry xml:id="constant.json-error-none">
<term>
<constant>JSON_ERROR_NONE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
No error has occurred.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-depth">
<term>
<constant>JSON_ERROR_DEPTH</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
The maximum stack depth has been exceeded.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-state-mismatch">
<term>
<constant>JSON_ERROR_STATE_MISMATCH</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Occurs with underflow or with the modes mismatch.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-ctrl-char">
<term>
<constant>JSON_ERROR_CTRL_CHAR</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Control character error, possibly incorrectly encoded.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-syntax">
<term>
<constant>JSON_ERROR_SYNTAX</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Syntax error.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-utf8">
<term>
<constant>JSON_ERROR_UTF8</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Malformed UTF-8 characters, possibly incorrectly encoded.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-recursion">
<term>
<constant>JSON_ERROR_RECURSION</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
The object or array passed to <function>json_encode</function> include
recursive references and cannot be encoded.
If the <constant>JSON_PARTIAL_OUTPUT_ON_ERROR</constant> option was
given, &null; will be encoded in the place of the recursive reference.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-inf-or-nan">
<term>
<constant>JSON_ERROR_INF_OR_NAN</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
The value passed to <function>json_encode</function> includes either
<link linkend="language.types.float.nan"><constant>NAN</constant></link>
or <link linkend="function.is-infinite"><constant>INF</constant></link>.
If the <constant>JSON_PARTIAL_OUTPUT_ON_ERROR</constant> option was
given, <literal>0</literal> will be encoded in the place of these
special numbers.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-unsupported-type">
<term>
<constant>JSON_ERROR_UNSUPPORTED_TYPE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
A value of an unsupported type was given to
<function>json_encode</function>, such as a &resource;.
If the <constant>JSON_PARTIAL_OUTPUT_ON_ERROR</constant> option was
given, &null; will be encoded in the place of the unsupported value.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-invalid-property-name">
<term>
<constant>JSON_ERROR_INVALID_PROPERTY_NAME</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
A key starting with \u0000 character was in the string passed to
<function>json_decode</function> when decoding a JSON object into a PHP
object.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-utf16">
<term>
<constant>JSON_ERROR_UTF16</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Single unpaired UTF-16 surrogate in unicode escape contained in the
JSON string passed to <function>json_decode</function>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
The following constants can be combined to form options for
<function>json_decode</function>.
</para>
<variablelist>
<varlistentry xml:id="constant.json-bigint-as-string">
<term>
<constant>JSON_BIGINT_AS_STRING</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Decodes large integers as their original string value.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-object-as-array">
<term>
<constant>JSON_OBJECT_AS_ARRAY</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Decodes JSON objects as PHP array. This option can be added automatically
by calling <function>json_decode</function> with the second parameter
equal to &true;.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
The following constants can be combined to form options for
<function>json_encode</function>.
</para>
<variablelist>
<varlistentry xml:id="constant.json-hex-tag">
<term>
<constant>JSON_HEX_TAG</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
All < and > are converted to \u003C and \u003E.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-hex-amp">
<term>
<constant>JSON_HEX_AMP</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
All & are converted to \u0026.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-hex-apos">
<term>
<constant>JSON_HEX_APOS</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
All ' are converted to \u0027.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-hex-quot">
<term>
<constant>JSON_HEX_QUOT</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
All " are converted to \u0022.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-force-object">
<term>
<constant>JSON_FORCE_OBJECT</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Outputs an object rather than an array when a non-associative array is
used. Especially useful when the recipient of the output is expecting
an object and the array is empty.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-numeric-check">
<term>
<constant>JSON_NUMERIC_CHECK</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Encodes numeric strings as numbers.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-pretty-print">
<term>
<constant>JSON_PRETTY_PRINT</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Use whitespace in returned data to format it.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-unescaped-slashes">
<term>
<constant>JSON_UNESCAPED_SLASHES</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Don't escape <literal>/</literal>.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-unescaped-unicode">
<term>
<constant>JSON_UNESCAPED_UNICODE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Encode multibyte Unicode characters literally (default is to escape as
\uXXXX).
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-partial-output-on-error">
<term>
<constant>JSON_PARTIAL_OUTPUT_ON_ERROR</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Substitute some unencodable values instead of failing.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-preserve-zero-fraction">
<term>
<constant>JSON_PRESERVE_ZERO_FRACTION</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Ensures that &float; values are always encoded as a float value.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-unescaped-line-terminators">
<term>
<constant>JSON_UNESCAPED_LINE_TERMINATORS</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
The line terminators are kept unescaped when
<constant>JSON_UNESCAPED_UNICODE</constant> is supplied. It uses the same
behaviour as it was before PHP 7.1 without this constant.
Available as of PHP 7.1.0.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
The following constants can be combined to form options for
<function>json_decode</function> and <function>json_encode</function>.
</para>
<variablelist>
<varlistentry xml:id="constant.json-invalid-utf8-ignore">
<term>
<constant>JSON_INVALID_UTF8_IGNORE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Ignore invalid UTF-8 characters.
Available as of PHP 7.2.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-invalid-utf8-substitute">
<term>
<constant>JSON_INVALID_UTF8_SUBSTITUTE</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Convert invalid UTF-8 characters to \0xfffd
(Unicode Character 'REPLACEMENT CHARACTER')
Available as of PHP 7.2.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-throw-on-error">
<term>
<constant>JSON_THROW_ON_ERROR</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
Throws <classname>JsonException</classname> if an error occurs instead
of setting the global error state that is retrieved with
<function>json_last_error</function> and <function>json_last_error_msg</function>.
<constant>JSON_PARTIAL_OUTPUT_ON_ERROR</constant> takes precedence over
<constant>JSON_THROW_ON_ERROR</constant>.
Available as of PHP 7.3.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-non-backed-enum">
<term>
<constant>JSON_ERROR_NON_BACKED_ENUM</constant>
(<type>int</type>)
</term>
<listitem>
<simpara>
The value passed to <function>json_encode</function>
includes a non-backed enum which cannot be serialized.
Available as of PHP 8.1.0.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->