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

contributors($setup);

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

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

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     If a parameter with a default value is followed by a required parameter, the default value has
     no effect. This is deprecated as of PHP 8.0.0 and can generally be resolved by dropping the
     default value, without a change in functionality:
    </p>
    <p class="para">
     <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 </span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">$a </span><span style="color: #007700">= [], </span><span style="color: #0000BB">$b</span><span style="color: #007700">) {} </span><span style="color: #FF8000">// Before<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) {}      </span><span style="color: #FF8000">// After<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </p>
    <p class="para">
     One exception to this rule are parameters of the form <code class="code">Type $param = null</code>, where
     the null default makes the type implicitly nullable. This usage remains allowed, but it is
     recommended to use an explicit nullable type instead:
    </p>
    <p class="para">
     <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 </span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">A $a </span><span style="color: #007700">= </span><span style="color: #0000BB">null</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) {} </span><span style="color: #FF8000">// Still allowed<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">test</span><span style="color: #007700">(?</span><span style="color: #0000BB">A $a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) {}       </span><span style="color: #FF8000">// Recommended<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Calling <span class="function"><a href="function.get-defined-functions.php" class="function">get_defined_functions()</a></span> with <code class="parameter">exclude_disabled</code>
     explicitly set to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is deprecated and no longer has an effect.
     <span class="function"><a href="function.get-defined-functions.php" class="function">get_defined_functions()</a></span> will never include disabled functions.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.deprecated.enchant">
  <h3 class="title">Enchant</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-broker-set-dict-path.php" class="function">enchant_broker_set_dict_path()</a></span> and
     <span class="function"><a href="function.enchant-broker-get-dict-path.php" class="function">enchant_broker_get_dict_path()</a></span>
     are deprecated, because that functionality is neither available in libenchant &lt; 1.5 nor in
     libenchant-2.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-dict-add-to-personal.php" class="function">enchant_dict_add_to_personal()</a></span> is deprecated; use
     <span class="function"><a href="function.enchant-dict-add.php" class="function">enchant_dict_add()</a></span> instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-dict-is-in-session.php" class="function">enchant_dict_is_in_session()</a></span> is deprecated; use
     <span class="function"><a href="function.enchant-dict-is-added.php" class="function">enchant_dict_is_added()</a></span> instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="function"><a href="function.enchant-broker-free.php" class="function">enchant_broker_free()</a></span> and <span class="function"><a href="function.enchant-broker-free-dict.php" class="function">enchant_broker_free_dict()</a></span> are
     deprecated; unset the object instead.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The <strong><code><a href="enchant.constants.php#constant.enchant-myspell">ENCHANT_MYSPELL</a></code></strong> and <strong><code><a href="enchant.constants.php#constant.enchant-ispell">ENCHANT_ISPELL</a></code></strong> constants are
     deprecated.
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.deprecated.libxml">
  <h3 class="title">LibXML</h3>

  <p class="para">
   <span class="function"><a href="function.libxml-disable-entity-loader.php" class="function">libxml_disable_entity_loader()</a></span> has been deprecated. As libxml 2.9.0 is now
   required, external entity loading is guaranteed to be disabled by default, and this function is
   no longer needed to protect against XXE attacks, unless the (still vulnerable)
   <strong><code><a href="libxml.constants.php#constant.libxml-noent">LIBXML_NOENT</a></code></strong> is used.
   In that case, it is recommended to refactor the code using
   <span class="function"><a href="function.libxml-set-external-entity-loader.php" class="function">libxml_set_external_entity_loader()</a></span> to suppress loading of external entities.
  </p>
 </div>

 <div class="sect2" id="migration80.deprecated.pgsql">
  <h3 class="title">PGSQL / PDO PGSQL</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     The constant <strong><code><a href="pgsql.constants.php#constant.pgsql-libpq-version-str">PGSQL_LIBPQ_VERSION_STR</a></code></strong> now has the same value as
     <strong><code><a href="pgsql.constants.php#constant.pgsql-libpq-version">PGSQL_LIBPQ_VERSION</a></code></strong>, and thus is deprecated.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     Function aliases in the pgsql extension have been deprecated.
     See the following list for which functions should be used instead:
    </p>
    <p class="para">
     <ul class="simplelist">
      <li><span class="function"><strong>pg_errormessage()</strong></span> → <span class="function"><a href="function.pg-last-error.php" class="function">pg_last_error()</a></span></li>
      <li><span class="function"><strong>pg_numrows()</strong></span> → <span class="function"><a href="function.pg-num-rows.php" class="function">pg_num_rows()</a></span></li>
      <li><span class="function"><strong>pg_numfields()</strong></span> → <span class="function"><a href="function.pg-num-fields.php" class="function">pg_num_fields()</a></span></li>
      <li><span class="function"><strong>pg_cmdtuples()</strong></span> → <span class="function"><a href="function.pg-affected-rows.php" class="function">pg_affected_rows()</a></span></li>
      <li><span class="function"><strong>pg_fieldname()</strong></span> → <span class="function"><a href="function.pg-field-name.php" class="function">pg_field_name()</a></span></li>
      <li><span class="function"><strong>pg_fieldsize()</strong></span> → <span class="function"><a href="function.pg-field-size.php" class="function">pg_field_size()</a></span></li>
      <li><span class="function"><strong>pg_fieldtype()</strong></span> → <span class="function"><a href="function.pg-field-type.php" class="function">pg_field_type()</a></span></li>
      <li><span class="function"><strong>pg_fieldnum()</strong></span> → <span class="function"><a href="function.pg-field-num.php" class="function">pg_field_num()</a></span></li>
      <li><span class="function"><strong>pg_result()</strong></span> → <span class="function"><a href="function.pg-fetch-result.php" class="function">pg_fetch_result()</a></span></li>
      <li><span class="function"><strong>pg_fieldprtlen()</strong></span> → <span class="function"><a href="function.pg-field-prtlen.php" class="function">pg_field_prtlen()</a></span></li>
      <li><span class="function"><strong>pg_fieldisnull()</strong></span> → <span class="function"><a href="function.pg-field-is-null.php" class="function">pg_field_is_null()</a></span></li>
      <li><span class="function"><strong>pg_freeresult()</strong></span> → <span class="function"><a href="function.pg-free-result.php" class="function">pg_free_result()</a></span></li>
      <li><span class="function"><strong>pg_getlastoid()</strong></span> → <span class="function"><a href="function.pg-last-oid.php" class="function">pg_last_oid()</a></span></li>
      <li><span class="function"><strong>pg_locreate()</strong></span> → <span class="function"><a href="function.pg-lo-create.php" class="function">pg_lo_create()</a></span></li>
      <li><span class="function"><strong>pg_lounlink()</strong></span> → <span class="function"><a href="function.pg-lo-unlink.php" class="function">pg_lo_unlink()</a></span></li>
      <li><span class="function"><strong>pg_loopen()</strong></span> → <span class="function"><a href="function.pg-lo-open.php" class="function">pg_lo_open()</a></span></li>
      <li><span class="function"><strong>pg_loclose()</strong></span> → <span class="function"><a href="function.pg-lo-close.php" class="function">pg_lo_close()</a></span></li>
      <li><span class="function"><strong>pg_loread()</strong></span> → <span class="function"><a href="function.pg-lo-read.php" class="function">pg_lo_read()</a></span></li>
      <li><span class="function"><strong>pg_lowrite()</strong></span> → <span class="function"><a href="function.pg-lo-write.php" class="function">pg_lo_write()</a></span></li>
      <li><span class="function"><strong>pg_loreadall()</strong></span> → <span class="function"><a href="function.pg-lo-read-all.php" class="function">pg_lo_read_all()</a></span></li>
      <li><span class="function"><strong>pg_loimport()</strong></span> → <span class="function"><a href="function.pg-lo-import.php" class="function">pg_lo_import()</a></span></li>
      <li><span class="function"><strong>pg_loexport()</strong></span> → <span class="function"><a href="function.pg-lo-export.php" class="function">pg_lo_export()</a></span></li>
      <li><span class="function"><strong>pg_setclientencoding()</strong></span> → <span class="function"><a href="function.pg-set-client-encoding.php" class="function">pg_set_client_encoding()</a></span></li>
      <li><span class="function"><strong>pg_clientencoding()</strong></span> -> <span class="function"><a href="function.pg-client-encoding.php" class="function">pg_client_encoding()</a></span></li>
     </ul>
    </p>
   </li>
  </ul>
 </div>

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

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     Sort comparison functions that return <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> will now throw a deprecation warning, and
     should be replaced with an implementation that returns an integer less than, equal to, or greater
     than zero.
    </p>
    <p class="para">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Replace<br /></span><span style="color: #0000BB">usort</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">, fn(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) =&gt; </span><span style="color: #0000BB">$a </span><span style="color: #007700">&gt; </span><span style="color: #0000BB">$b</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// With<br /></span><span style="color: #0000BB">usort</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">, fn(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) =&gt; </span><span style="color: #0000BB">$a </span><span style="color: #007700">&lt;=&gt; </span><span style="color: #0000BB">$b</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>
 
    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.deprecated.zip">
  <h3 class="title">Zip</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     Using an empty file as ZipArchive is deprecated. Libzip 1.6.0 does not accept empty files as
     valid zip archives any longer. The existing workaround will be removed in the next version.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     The procedural API of Zip is deprecated. Use <span class="classname"><a href="class.ziparchive.php" class="classname">ZipArchive</a></span> instead.
     Iteration over all entries can be accomplished using <span class="methodname"><a href="ziparchive.statindex.php" class="methodname">ZipArchive::statIndex()</a></span>
     and a <a href="control-structures.for.php" class="link">for</a> loop:
    </p>
    <p class="para">
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// iterate using the procedural API<br /></span><span style="color: #0000BB">assert</span><span style="color: #007700">(</span><span style="color: #0000BB">is_resource</span><span style="color: #007700">(</span><span style="color: #0000BB">$zip</span><span style="color: #007700">));<br />while (</span><span style="color: #0000BB">$entry </span><span style="color: #007700">= </span><span style="color: #0000BB">zip_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$zip</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #0000BB">zip_entry_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$entry</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">// iterate using the object-oriented API<br /></span><span style="color: #0000BB">assert</span><span style="color: #007700">(</span><span style="color: #0000BB">$zip </span><span style="color: #007700">instanceof </span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">);<br />for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$entry </span><span style="color: #007700">= </span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">statIndex</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">); </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) {<br />    echo </span><span style="color: #0000BB">$entry</span><span style="color: #007700">[</span><span style="color: #DD0000">'name'</span><span style="color: #007700">];<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </p>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration80.deprecated.reflection">
  <h3 class="title">Reflection</h3>

  <ul class="itemizedlist">
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="reflectionfunction.isdisabled.php" class="methodname">ReflectionFunction::isDisabled()</a></span> is deprecated, as it is no longer
     possible to create a <span class="classname"><a href="class.reflectionfunction.php" class="classname">ReflectionFunction</a></span> for a disabled function. This
     method now always returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
    </p>
   </li>
   <li class="listitem">
    <p class="para">
     <span class="methodname"><a href="reflectionparameter.getclass.php" class="methodname">ReflectionParameter::getClass()</a></span>,
     <span class="methodname"><a href="reflectionparameter.isarray.php" class="methodname">ReflectionParameter::isArray()</a></span>, and
     <span class="methodname"><a href="reflectionparameter.iscallable.php" class="methodname">ReflectionParameter::isCallable()</a></span> are deprecated.
     <span class="methodname"><a href="reflectionparameter.gettype.php" class="methodname">ReflectionParameter::getType()</a></span> and the
     <span class="classname"><a href="class.reflectiontype.php" class="classname">ReflectionType</a></span> APIs should be used instead.
    </p>
   </li>
  </ul>
 </div>

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