<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration81.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'migration81.deprecated.php',
    1 => 'Deprecated Features',
    2 => 'Deprecated Features',
  ),
  'up' => 
  array (
    0 => 'migration81.php',
    1 => 'Перехід від PHP 8.0.x до PHP 8.1.x',
  ),
  'prev' => 
  array (
    0 => 'migration81.incompatible.php',
    1 => 'Backward Incompatible Changes',
  ),
  'next' => 
  array (
    0 => 'migration81.other-changes.php',
    1 => 'Other Changes',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'appendices/migration81/deprecated.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="migration81.deprecated" class="sect1">
 <h2 class="title">Deprecated Features</h2>

 <div class="sect2" id="migration81.deprecated.core">
  <h3 class="title">PHP Core</h3>

  <div class="sect3" id="migration81.deprecated.core.serialize-interface">
   <h4 class="title">
    Implementing <span class="interfacename"><a href="class.serializable.php" class="interfacename">Serializable</a></span> without
    <span class="function"><strong>__serialize()</strong></span> and <span class="function"><strong>__unserialize()</strong></span>
   </h4>

   <p class="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.
   </p>
  </div>

  <div class="sect3" id="migration81.deprecated.core.null-not-nullable-internal">
   <h4 class="title">Passing <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> to non-nullable parameters of built-in functions</h4>

   <p class="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.

    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">str_contains</span><span style="color: #007700">(</span><span style="color: #DD0000">"foobar"</span><span style="color: #007700">, </span><span style="color: #0000BB">null</span><span style="color: #007700">));<br /></span><span style="color: #FF8000">// Deprecated: Passing null to parameter #2 ($needle) of type string<br />//             is deprecated<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
  </div>

  <div class="sect3" id="migration81.deprecated.core.implicit-float-conversion">
   <h4 class="title">Implicit incompatible <span class="type"><a href="language.types.float.php" class="type float">float</a></span> to <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> conversions</h4>

   <p class="para">
    The implicit conversion of <span class="type"><a href="language.types.float.php" class="type float">float</a></span> to <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> which
    leads to a loss in precision is now deprecated.
    This affects <span class="type"><a href="language.types.array.php" class="type array">array</a></span> keys, <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> type declarations in coercive mode,
    and operators working on <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>s.

    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$a </span><span style="color: #007700">= [];<br /></span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #0000BB">15.5</span><span style="color: #007700">]; </span><span style="color: #FF8000">// deprecated, as key value loses the 0.5 component<br /></span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #0000BB">15.0</span><span style="color: #007700">]; </span><span style="color: #FF8000">// ok, as 15.0 == 15<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
  </div>

  <div class="sect3" id="migration81.deprecated.core.static-trait">
   <h4 class="title">Calling a <span class="modifier">static</span> element on a trait</h4>

   <p class="para">
    Calling a <span class="modifier">static</span> method, or accessing a
    <span class="modifier">static</span> property directly on a trait is deprecated.
    Static methods and properties should only be accessed on a class using the trait.
   </p>
  </div>

  <div class="sect3" id="migration81.deprecated.core.magic-sleep">
   <h4 class="title">Returning a non-<span class="type"><a href="language.types.array.php" class="type array">array</a></span> from <span class="function"><strong>__sleep()</strong></span></h4>

   <p class="para">
    Returning a value which is not an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> from
    <a href="language.oop5.magic.php#object.sleep" class="link">__sleep()</a> now generates a diagnostic.
   </p>
  </div>

  <div class="sect3" id="migration81.deprecated.core.void-by-ref">
   <h4 class="title">Returning by reference from a <span class="type"><span class="type"><a href="language.types.void.php" class="type void">void</a></span></span> function</h4>

   <p class="para">
    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function &amp;</span><span style="color: #0000BB">test</span><span style="color: #007700">(): </span><span style="color: #0000BB">void </span><span style="color: #007700">{}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
    Such a function is contradictory, and already emits the following
    <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong> when called:
    <code class="literal">Only variable references should be returned by reference</code>.
   </p>
  </div>

  <div class="sect3" id="migration81.deprecated.core.autovivification-false">
   <h4 class="title">Autovivification from <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></h4>
   <p class="para">
    Autovivification is the process of creating a new <span class="type"><a href="language.types.array.php" class="type array">array</a></span> when
    appending to a value.
    Autovivification is prohibited from scalar values, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> however
    was an exception. This is now deprecated.

    <div class="informalexample">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$arr </span><span style="color: #007700">= </span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[] = </span><span style="color: #0000BB">2</span><span style="color: #007700">;   </span><span style="color: #FF8000">// deprecated<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
   <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
    <p class="para">
     Autovivification from <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> and undefined values is still allowed:
     <div class="informalexample">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// From undefined<br /></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[] = </span><span style="color: #DD0000">'some value'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[</span><span style="color: #DD0000">'doesNotExist'</span><span style="color: #007700">][] = </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">// From null<br /></span><span style="color: #0000BB">$arr </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$arr</span><span style="color: #007700">[] = </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
   </p></blockquote>
  </div>

 </div>

 <div class="sect2" id="migration81.deprecated.ctype">
  <h3 class="title">ctype</h3>

  <div class="sect3" id="migration81.deprecated.ctype.nonstring-arguments">
   <h4 class="title">Verifying non-string arguments</h4>

   <p class="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
    cast to <span class="type"><a href="language.types.string.php" class="type string">string</a></span> or an explicit call to
    <span class="function"><a href="function.chr.php" class="function">chr()</a></span> should be made.
    All <code class="literal">ctype_*()</code> functions are affected.
   </p>
  </div>
 </div>

 <div class="sect2" id="migration81.deprecated.date">
  <h3 class="title">Date</h3>

  <p class="para">
   <span class="function"><a href="function.date-sunrise.php" class="function">date_sunrise()</a></span> and <span class="function"><a href="function.date-sunset.php" class="function">date_sunset()</a></span>
   have been deprecated in favor of <span class="function"><a href="function.date-sun-info.php" class="function">date_sun_info()</a></span>.
  </p>

  <p class="para">
   <span class="function"><a href="function.strptime.php" class="function">strptime()</a></span> has been deprecated.
   Use <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span> instead (for locale-independent parsing),
   or <span class="methodname"><a href="intldateformatter.parse.php" class="methodname">IntlDateFormatter::parse()</a></span> (for locale-dependent parsing).
  </p>

  <p class="para">
   <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span> and <span class="function"><a href="function.gmstrftime.php" class="function">gmstrftime()</a></span> have been deprecated.
   Use <span class="function"><a href="function.date.php" class="function">date()</a></span> instead (for locale-independent formatting),
   or <span class="methodname"><a href="intldateformatter.format.php" class="methodname">IntlDateFormatter::format()</a></span> (for locale-dependent formatting).
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.filter">
  <h3 class="title">Filter</h3>

  <p class="para">
   The <strong><code><a href="filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_STRING</a></code></strong> and
   <strong><code><a href="filter.constants.php#constant.filter-sanitize-stripped">FILTER_SANITIZE_STRIPPED</a></code></strong> filters are deprecated.
  </p>
  <p class="para">
   The <a href="filter.configuration.php#ini.filter.default" class="link">filter.default</a>
   INI directive is deprecated.
   
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.gd">
  <h3 class="title">GD</h3>

  <p class="para">
   The <code class="parameter">num_points</code> of <span class="function"><a href="function.imagepolygon.php" class="function">imagepolygon()</a></span>,
   <span class="function"><a href="function.imageopenpolygon.php" class="function">imageopenpolygon()</a></span> and <span class="function"><a href="function.imagefilledpolygon.php" class="function">imagefilledpolygon()</a></span>
   has been deprecated.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.hash">
  <h3 class="title">Hash</h3>

  <p class="para">
   The <span class="function"><a href="function.mhash.php" class="function">mhash()</a></span>,
   <span class="function"><a href="function.mhash-keygen-s2k.php" class="function">mhash_keygen_s2k()</a></span>,
   <span class="function"><a href="function.mhash-count.php" class="function">mhash_count()</a></span>,
   <span class="function"><a href="function.mhash-get-block-size.php" class="function">mhash_get_block_size()</a></span>,
   and <span class="function"><a href="function.mhash-get-hash-name.php" class="function">mhash_get_hash_name()</a></span> have been deprecated.
   Use the <code class="literal">hash_*()</code> functions instead.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.imap">
  <h3 class="title">IMAP</h3>

  <p class="para">
   The <strong><code><a href="imap.constants.php#constant.nil">NIL</a></code></strong> constant has been deprecated.
   Use <code class="literal">0</code> instead.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.intl">
  <h3 class="title">Intl</h3>

  <p class="para">
   Calling <span class="methodname"><a href="intlcalendar.roll.php" class="methodname">IntlCalendar::roll()</a></span> with a
   <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> argument is deprecated.
   Use <code class="literal">1</code> and <code class="literal">-1</code> instead of
   <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> respectively.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.mbstring">
  <h3 class="title">Multibyte String</h3>

  <p class="para">
   Calling <span class="function"><a href="function.mb-check-encoding.php" class="function">mb_check_encoding()</a></span> without any arguments
   is deprecated.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.mysqli">
  <h3 class="title">MySQLi</h3>

  <p class="para">
   The <span class="property"><a href="class.mysqli-driver.php#mysqli-driver.props.driver-version">mysqli_driver::$driver_version</a></span> property
   has been deprecated.
   It was meaningless and outdated, use <strong><code><a href="reserved.constants.php#constant.php-version-id">PHP_VERSION_ID</a></code></strong>
   instead.
  </p>

  <p class="para">
   Calling <span class="methodname"><a href="mysqli.get-client-info.php" class="methodname">mysqli::get_client_info()</a></span> or
   <span class="function"><a href="mysqli.get-client-info.php" class="function">mysqli_get_client_info()</a></span> with the
   <code class="parameter">mysqli</code> argument has been deprecated.
   Call <span class="function"><a href="mysqli.get-client-info.php" class="function">mysqli_get_client_info()</a></span> without any arguments
   to obtain the version information of the client library.
  </p>

  <p class="para">
   The <span class="methodname"><a href="mysqli.init.php" class="methodname">mysqli::init()</a></span> method has been deprecated.
   Replace calls to <span class="methodname"><strong>parent::init()</strong></span> with
   <span class="methodname"><strong>parent::__construct()</strong></span>.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.oci8">
  <h3 class="title">OCI8</h3>

  <p class="para">
   The <a href="oci8.configuration.php#ini.oci8.old-oci-close-semantics" class="link">oci8.old_oci_close_semantics</a>
   INI directive is deprecated.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.odbc">
  <h3 class="title">ODBC</h3>

  <p class="para">
   <span class="function"><a href="function.odbc-result-all.php" class="function">odbc_result_all()</a></span> has been deprecated.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.pdo">
  <h3 class="title">PDO</h3>

  <p class="para">
   The <strong><code><a href="pdo.constants.fetch-modes.php#pdo.constants.fetch-serialize">PDO::FETCH_SERIALIZE</a></code></strong> fetch mode has been deprecated.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.pgsql">
  <h3 class="title">PgSQL</h3>

  <p class="para">
   Not passing the connection argument to all <code class="literal">pgsql_*()</code>
   functions has been deprecated.
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.soap">
  <h3 class="title">SOAP</h3>

  <p class="para">
   The <code class="literal">ssl_method</code> option of
   <span class="methodname"><a href="soapclient.construct.php" class="methodname">SoapClient::__construct()</a></span> has been deprecated
   in favor of SSL stream context options.
   
  </p>
 </div>

 <div class="sect2" id="migration81.deprecated.standard">
  <h3 class="title">Standard</h3>

  <p class="para">
   Calling <span class="function"><a href="function.key.php" class="function">key()</a></span>, <span class="function"><a href="function.current.php" class="function">current()</a></span>,
   <span class="function"><a href="function.next.php" class="function">next()</a></span>, <span class="function"><a href="function.prev.php" class="function">prev()</a></span>,
   <span class="function"><a href="function.reset.php" class="function">reset()</a></span>, or <span class="function"><a href="function.end.php" class="function">end()</a></span>
   on <span class="type"><a href="language.types.object.php" class="type object">object</a></span>s is deprecated.
   Either convert the <span class="type"><a href="language.types.object.php" class="type object">object</a></span> to an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> using <span class="function"><a href="function.get-mangled-object-vars.php" class="function">get_mangled_object_vars()</a></span>
   first, or use the methods provided by a class that implements
   <span class="interfacename"><a href="class.iterator.php" class="interfacename">Iterator</a></span>, such as <span class="classname"><a href="class.arrayiterator.php" class="classname">ArrayIterator</a></span>, instead.
  </p>

  <p class="para">
   The <a href="filesystem.configuration.php#ini.auto-detect-line-endings" class="link">auto_detect_line_endings</a>
   INI directive is deprecated.
   If necessary, handle <code class="literal">&quot;\r&quot;</code> line breaks manually instead.
  </p>

  <p class="para">
   The <strong><code><a href="filesystem.constants.php#constant.file-binary">FILE_BINARY</a></code></strong> and
   <strong><code><a href="filesystem.constants.php#constant.file-text">FILE_TEXT</a></code></strong> constants have been deprecated.
   They never had any effect.
  </p>
 </div>

</div><?php manual_footer($setup); ?>