2021-09-22 14:13:39 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<sect1 xml:id="migration81.deprecated">
|
|
|
|
<title>Deprecated Features</title>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.core">
|
|
|
|
<title>PHP Core</title>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.serialize-interface">
|
|
|
|
<title>
|
|
|
|
Implementing <interfacename>Serializable</interfacename> without
|
|
|
|
<function>__serialize</function> and <function>__unserialize</function>
|
|
|
|
</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Either only the new methods should be implemented, if no support for
|
|
|
|
PHP prior to version 7.4 is provided, or both should be implemented.
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.null-not-nullable-internal">
|
|
|
|
<title>Passing &null; to non-nullable parameters of built-in functions</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Scalar types for built-in functions are nullable by default,
|
|
|
|
this behaviour is deprecated to align with the behaviour of user-defined
|
|
|
|
functions, where scalar types need to be marked as nullable explicitly.
|
|
|
|
|
|
|
|
<informalexample>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
var_dump(str_contains("foobar", null));
|
|
|
|
// Deprecated: Passing null to parameter #2 ($needle) of type string
|
|
|
|
// is deprecated
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.implicit-float-conversion">
|
|
|
|
<title>Implicit incompatible &float; to &integer; conversions</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The implicit conversion of &float; to &integer; which
|
|
|
|
leads to a loss in precision is now deprecated.
|
|
|
|
This affects &array; keys, &integer; type declarations in coercive mode,
|
|
|
|
and operators working on &integer;s.
|
|
|
|
|
|
|
|
<informalexample>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$a = [];
|
|
|
|
$a[15.5]; // deprecated, as key value loses the 0.5 component
|
|
|
|
$a[15.0]; // ok, as 15.0 == 15
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.static-trait">
|
|
|
|
<title>Calling a <modifier>static</modifier> element on a trait</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Calling a <modifier>static</modifier> method, or accessing a
|
|
|
|
<modifier>static</modifier> property directly on a trait is deprecated.
|
|
|
|
Static methods and properties should only be accessed on a class using the trait.
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.magic-sleep">
|
|
|
|
<title>Returning a non-&array; from <function>__sleep</function></title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Returning a value which is not an &array; from
|
|
|
|
<link linkend="object.sleep">__sleep()</link> now generates a diagnostic.
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.void-by-ref">
|
|
|
|
<title>Returning by reference from a <type>void</type> function</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<informalexample>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
function &test(): void {}
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
Such a function is contradictory, and already emits the following
|
|
|
|
<constant>E_NOTICE</constant> when called:
|
|
|
|
<literal>Only variable references should be returned by reference</literal>.
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.core.autovivification-false">
|
|
|
|
<title>Autovivification from &false;</title>
|
|
|
|
<para>
|
|
|
|
Autovivification is the process of creating a new &array; when
|
|
|
|
appending to a value.
|
|
|
|
Autovivification is prohibited from scalar values, &false; however
|
|
|
|
was an exception. This is now deprecated.
|
|
|
|
|
|
|
|
<informalexample>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$arr = false;
|
|
|
|
$arr[] = 2; // deprecated
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
</para>
|
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
Autovivification from &null; and undefined values is still allowed:
|
|
|
|
<informalexample>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// From undefined
|
|
|
|
$arr[] = 'some value';
|
|
|
|
$arr['doesNotExist'][] = 2;
|
|
|
|
// From null
|
|
|
|
$arr = null;
|
|
|
|
$arr[] = 2;
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</sect3>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.ctype">
|
|
|
|
<title>ctype</title>
|
|
|
|
|
|
|
|
<sect3 xml:id="migration81.deprecated.ctype.nonstring-arguments">
|
|
|
|
<title>Verifying non-string arguments</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Passing a non-string argument is deprecated.
|
|
|
|
In the future, the argument will be interpreted as a string instead
|
|
|
|
of an ASCII codepoint.
|
|
|
|
Depending on the intended behavior, the argument should either be
|
2021-12-08 11:18:41 +00:00
|
|
|
cast to &string; or an explicit call to
|
2021-09-22 14:13:39 +00:00
|
|
|
<function>chr</function> should be made.
|
|
|
|
All <literal>ctype_*()</literal> functions are affected.
|
|
|
|
</para>
|
|
|
|
</sect3>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.date">
|
|
|
|
<title>Date</title>
|
|
|
|
|
|
|
|
<para>
|
2021-11-29 16:34:32 +00:00
|
|
|
<function>date_sunrise</function> and <function>date_sunset</function>
|
2021-09-22 14:13:39 +00:00
|
|
|
have been deprecated in favor of <function>date_sun_info</function>.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2021-11-29 16:34:32 +00:00
|
|
|
<function>strptime</function> has been deprecated.
|
2021-09-22 14:13:39 +00:00
|
|
|
Use <function>date_parse_from_format</function> instead (for locale-independent parsing),
|
|
|
|
or <methodname>IntlDateFormatter::parse</methodname> (for locale-dependent parsing).
|
|
|
|
</para>
|
2021-11-29 16:34:32 +00:00
|
|
|
|
|
|
|
<para>
|
|
|
|
<function>strftime</function> and <function>gmstrftime</function> have been deprecated.
|
2021-12-18 13:25:25 +00:00
|
|
|
Use <function>date</function> instead (for locale-independent formatting),
|
|
|
|
or <methodname>IntlDateFormatter::format</methodname> (for locale-dependent formatting).
|
2021-11-29 16:34:32 +00:00
|
|
|
</para>
|
2021-09-22 14:13:39 +00:00
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.filter">
|
|
|
|
<title>Filter</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <constant>FILTER_SANITIZE_STRING</constant> and
|
|
|
|
<constant>FILTER_SANITIZE_STRIPPED</constant> filters are deprecated.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The <link linkend="ini.filter.default">filter.default</link>
|
|
|
|
INI directive is deprecated.
|
|
|
|
<!-- TODO Check that filter.default_flags -->
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.gd">
|
|
|
|
<title>GD</title>
|
|
|
|
|
|
|
|
<para>
|
2022-03-11 09:43:37 +00:00
|
|
|
The <parameter>num_points</parameter> of <function>imagepolygon</function>,
|
|
|
|
<function>imageopenpolygon</function> and <function>imagefilledpolygon</function>
|
|
|
|
has been deprecated.
|
2021-09-22 14:13:39 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.hash">
|
|
|
|
<title>Hash</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <function>mhash</function>,
|
|
|
|
<function>mhash_keygen_s2k</function>,
|
|
|
|
<function>mhash_count</function>,
|
|
|
|
<function>mhash_get_block_size</function>,
|
|
|
|
and <function>mhash_get_hash_name</function> have been deprecated.
|
|
|
|
Use the <literal>hash_*()</literal> functions instead.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.imap">
|
|
|
|
<title>IMAP</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <constant>NIL</constant> constant has been deprecated.
|
|
|
|
Use <literal>0</literal> instead.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.intl">
|
|
|
|
<title>Intl</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Calling <methodname>IntlCalendar::roll</methodname> with a
|
|
|
|
&boolean; argument is deprecated.
|
|
|
|
Use <literal>1</literal> and <literal>-1</literal> instead of
|
|
|
|
&true; and &false; respectively.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.mbstring">
|
|
|
|
<title>Multibyte String</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Calling <function>mb_check_encoding</function> without any arguments
|
|
|
|
is deprecated.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.mysqli">
|
|
|
|
<title>MySQLi</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <property>mysqli_driver::$driver_version</property> property
|
|
|
|
has been deprecated.
|
|
|
|
It was meaningless and outdated, use <constant>PHP_VERSION_ID</constant>
|
|
|
|
instead.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Calling <methodname>mysqli::get_client_info</methodname> or
|
|
|
|
<function>mysqli_get_client_info</function> with the
|
|
|
|
<parameter>mysqli</parameter> argument has been deprecated.
|
|
|
|
Call <function>mysqli_get_client_info</function> without any arguments
|
|
|
|
to obtain the version information of the client library.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <methodname>mysqli::init</methodname> method has been deprecated.
|
|
|
|
Replace calls to <methodname>parent::init</methodname> with
|
|
|
|
<methodname>parent::__construct</methodname>.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.oci8">
|
|
|
|
<title>OCI8</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <link linkend="ini.oci8.old-oci-close-semantics">oci8.old_oci_close_semantics</link>
|
|
|
|
INI directive is deprecated.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.odbc">
|
|
|
|
<title>ODBC</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<function>odbc_result_all</function> has been deprecated.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.pdo">
|
|
|
|
<title>PDO</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <constant>PDO::FETCH_SERIALIZE</constant> fetch mode has been deprecated.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.pgsql">
|
|
|
|
<title>PgSQL</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Not passing the connection argument to all <literal>pgsql_*()</literal>
|
|
|
|
functions has been deprecated.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.soap">
|
|
|
|
<title>SOAP</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <literal>ssl_method</literal> option of
|
|
|
|
<methodname>SoapClient::__construct</methodname> has been deprecated
|
|
|
|
in favor of SSL stream context options.
|
|
|
|
<!-- The direct equivalent would be
|
|
|
|
crypto_method, but min_proto_version/max_proto_version are recommended
|
|
|
|
instead. -->
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 xml:id="migration81.deprecated.standard">
|
|
|
|
<title>Standard</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Calling <function>key</function>, <function>current</function>,
|
|
|
|
<function>next</function>, <function>prev</function>,
|
|
|
|
<function>reset</function>, or <function>end</function>
|
|
|
|
on &object;s is deprecated.
|
|
|
|
Either use <function>get_mangled_object_vars</function> on the
|
|
|
|
object first, or use <classname>ArrayIterator</classname>.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <link linkend="ini.auto-detect-line-endings">auto_detect_line_endings</link>
|
|
|
|
INI directive is deprecated.
|
|
|
|
If necessary, handle <literal>"\r"</literal> line breaks manually instead.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The <constant>FILE_BINARY</constant> and
|
|
|
|
<constant>FILE_TEXT</constant> constants have been deprecated.
|
|
|
|
They never had any effect.
|
|
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
</sect1>
|
|
|
|
<!-- 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
|
|
|
|
-->
|