Skip to content
Merged
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
162 changes: 93 additions & 69 deletions reference/json/functions/json-last-error.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,89 +25,113 @@

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns an integer, the value can be one of the following
constants:
</simpara>
<para>
Returns an integer, the value can be one of the following
constants:
<variablelist>
<varlistentry>
<term><constant>JSON_ERROR_NONE</constant></term>
<listitem>
<simpara>No error has occurred</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_DEPTH</constant></term>
<listitem>
<simpara>The maximum stack depth has been exceeded</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_STATE_MISMATCH</constant></term>
<listitem>
<simpara>Invalid or malformed JSON</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_CTRL_CHAR</constant></term>
<listitem>
<simpara>Control character error, possibly incorrectly encoded</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_SYNTAX</constant></term>
<listitem>
<simpara>Syntax error</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_UTF8</constant></term>
<listitem>
<simpara>Malformed UTF-8 characters, possibly incorrectly encoded</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_RECURSION</constant></term>
<listitem>
<simpara>One or more recursive references in the value to be encoded</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_INF_OR_NAN</constant></term>
<listitem>
<simpara>
One or more
<link linkend="language.types.float.nan"><constant>NAN</constant></link>
or <link linkend="function.is-infinite"><constant>INF</constant></link>
values in the value to be encoded
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_UNSUPPORTED_TYPE</constant></term>
<listitem>
<simpara>A value of a type that cannot be encoded was given</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_INVALID_PROPERTY_NAME</constant></term>
<listitem>
<simpara>A property name that cannot be encoded was given</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_UTF16</constant></term>
<listitem>
<simpara>Malformed UTF-16 characters, possibly incorrectly encoded</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>JSON_ERROR_NON_BACKED_ENUM</constant></term>
<listitem>
<simpara>Value contains a non-backed enum which cannot be serialized</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
<table>
<title>JSON error codes</title>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Meaning</entry>
<entry>Availability</entry>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry><constant>JSON_ERROR_NONE</constant></entry>
<entry>No error has occurred</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_DEPTH</constant></entry>
<entry>The maximum stack depth has been exceeded</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_STATE_MISMATCH</constant></entry>
<entry>Invalid or malformed JSON</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_CTRL_CHAR</constant></entry>
<entry>Control character error, possibly incorrectly encoded</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_SYNTAX</constant></entry>
<entry>Syntax error</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_UTF8</constant></entry>
<entry>Malformed UTF-8 characters, possibly incorrectly encoded</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_RECURSION</constant></entry>
<entry>One or more recursive references in the value to be encoded</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_INF_OR_NAN</constant></entry>
<entry>8.1.0</entry>
<entry>
One or more
<link linkend="language.types.float.nan"><constant>NAN</constant></link>
or <link linkend="function.is-infinite"><constant>INF</constant></link>
values in the value to be encoded
<constant>JSON_ERROR_NON_BACKED_ENUM</constant> was added.
</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_UNSUPPORTED_TYPE</constant></entry>
<entry>A value of a type that cannot be encoded was given</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_INVALID_PROPERTY_NAME</constant></entry>
<entry>A property name that cannot be encoded was given</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_UTF16</constant></entry>
<entry>Malformed UTF-16 characters, possibly incorrectly encoded</entry>
<entry></entry>
</row>
<row>
<entry><constant>JSON_ERROR_NON_BACKED_ENUM</constant></entry>
<entry>Value contains a non-backed enum which cannot be serialized. Available as of PHP 8.1.0.</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</informaltable>
</refsect1>

<refsect1 role="examples">
Expand Down