Fix, improve and add missing JSON constants

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341082 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jakub Zelenka 2016-11-20 21:05:36 +00:00
parent e229fc66c2
commit 24e4bc70a6

View file

@ -76,8 +76,8 @@
</term>
<listitem>
<simpara>
Malformed UTF-8 characters, possibly incorrectly encoded. This
constant is available as of PHP 5.3.3.
Malformed UTF-8 characters, possibly incorrectly encoded.
Available since PHP 5.3.3.
</simpara>
</listitem>
</varlistentry>
@ -87,15 +87,13 @@
(<type>integer</type>)
</term>
<listitem>
<para>
<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.
</para>
<para>
This constant is available as of PHP 5.5.0.
</para>
Available since PHP 5.5.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-inf-or-nan">
@ -104,17 +102,15 @@
(<type>integer</type>)
</term>
<listitem>
<para>
<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.
</para>
<para>
This constant is available as of PHP 5.5.0.
</para>
Available since PHP 5.5.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-unsupported-type">
@ -123,43 +119,73 @@
(<type>integer</type>)
</term>
<listitem>
<para>
<simpara>
A value of an unsupported type was given to
<function>json_encode</function>, such as a <type>resource</type>.
If the <constant>JSON_PARTIAL_OUTPUT_ON_ERROR</constant> option was
given, &null; will be encoded in the place of the unsupported value.
</para>
<para>
This constant is available as of PHP 5.5.0.
</para>
Available since PHP 5.5.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-invalid-property-name">
<term>
<constant>JSON_ERROR_INVALID_PROPERTY_NAME</constant>
(<type>integer</type>)
(<type>integer</type>)
</term>
<listitem>
<para>
An invalid property name was given to <function>json_decode</function>.
</para>
<para>
This constant is available as of PHP 7.0.0.
</para>
<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.
Available since PHP 7.0.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-error-utf16">
<term>
<constant>JSON_ERROR_UTF16</constant>
(<type>integer</type>)
<constant>JSON_ERROR_INVALID_PROPERTY_NAME</constant>
(<type>integer</type>)
</term>
<listitem>
<para>
Invalid UTF-16 was given to <function>json_decode</function>.
</para>
<para>
This constant is available as of PHP 7.0.0.
</para>
<simpara>
Single unpaired UTF-16 surrogate in unicode escape contained in the
JSON string passed to <function>json_encode</function>.
Available since PHP 7.0.0.
</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>integer</type>)
</term>
<listitem>
<simpara>
Decodes large integers as their original string value.
Available since PHP 5.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-object-as-array">
<term>
<constant>JSON_OBJECT_AS_ARRAY</constant>
(<type>integer</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;.
Available since PHP 5.4.0.
</simpara>
</listitem>
</varlistentry>
</variablelist>
@ -243,18 +269,6 @@
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-bigint-as-string">
<term>
<constant>JSON_BIGINT_AS_STRING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Encodes large integers as their original string value.
Available since PHP 5.4.0.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-pretty-print">
<term>
<constant>JSON_PRETTY_PRINT</constant>
@ -286,7 +300,8 @@
</term>
<listitem>
<simpara>
Encode multibyte Unicode characters literally (default is to escape as \uXXXX).
Encode multibyte Unicode characters literally (default is to escape as
\uXXXX).
Available since PHP 5.4.0.
</simpara>
</listitem>
@ -303,19 +318,35 @@
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-preserve-zero-fraction">
<varlistentry xml:id="constant.json-preserve-zero-fraction">
<term>
<constant>JSON_PRESERVE_ZERO_FRACTION</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Ensures that <type>float</type> values are always encoded as a float value.
Ensures that <type>float</type> values are always encoded as a float
value.
Available since PHP 5.6.6.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="constant.json-unescaped-line-terminators">
<term>
<constant>JSON_UNESCAPED_LINE_TERMINATORS</constant>
(<type>integer</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 since PHP 7.1.0.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</appendix>
<!-- Keep this comment at the end of the file