mirror of
https://github.com/php/doc-es.git
synced 2026-03-23 23:12:09 +01:00
260 lines
9.0 KiB
XML
260 lines
9.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: ca9dbbbd2dcac26d56bbbb87539297e4589bd709 Maintainer: julionc Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<sect1 xml:id="migration80.deprecated">
|
|
<title>Funcionalidades obsoletas</title>
|
|
|
|
<sect2 xml:id="migration80.deprecated.core">
|
|
<title>Núcleo PHP</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
Si un parámetro con un valor predeterminado es seguido por un parámetro obligatorio, el valor predeterminado no
|
|
tiene efecto. Esto está obsoleto a partir de PHP 8.0.0 y generalmente puede resolverse eliminando el
|
|
valor predeterminado, sin cambiar la funcionalidad:
|
|
</para>
|
|
<para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function test($a = [], $b) {} // Before
|
|
function test($a, $b) {} // After
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</para>
|
|
<para>
|
|
Una excepción a esta regla son los parámetros de la forma <code>Type $param = null</code>, donde
|
|
el valor predeterminado null hace que el tipo sea implícitamente nullable. Este uso sigue estando permitido, pero se
|
|
recomienda usar un tipo nullable explícito en su lugar:
|
|
</para>
|
|
<para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function test(A $a = null, $b) {} // Still allowed
|
|
function test(?A $a, $b) {} // Recommended
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
Llamar a <function>get_defined_functions</function> con <parameter>exclude_disabled</parameter>
|
|
establecido explícitamente a &false; está obsoleto y ya no tiene efecto.
|
|
<function>get_defined_functions</function> nunca incluirá funciones deshabilitadas.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
|
|
<sect2 xml:id="migration80.deprecated.enchant">
|
|
<title>Enchant</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
<function>enchant_broker_set_dict_path</function> y
|
|
<function>enchant_broker_get_dict_path</function>
|
|
están obsoletas, porque esa funcionalidad no está disponible ni en libenchant < 1.5 ni en
|
|
libenchant-2.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<function>enchant_dict_add_to_personal</function> está obsoleta; use
|
|
<function>enchant_dict_add</function> en su lugar.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<function>enchant_dict_is_in_session</function> está obsoleta; use
|
|
<function>enchant_dict_is_added</function> en su lugar.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<function>enchant_broker_free</function> y <function>enchant_broker_free_dict</function> están
|
|
obsoletas; use unset sobre el objeto en su lugar.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
Las constantes <constant>ENCHANT_MYSPELL</constant> y <constant>ENCHANT_ISPELL</constant> están
|
|
obsoletas.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
|
|
<sect2 xml:id="migration80.deprecated.libxml">
|
|
<title>LibXML</title>
|
|
|
|
<para>
|
|
<function>libxml_disable_entity_loader</function> ha sido desaprobada. Como ahora se requiere libxml 2.9.0,
|
|
la carga de entidades externas está garantizada como deshabilitada por defecto, y esta función ya
|
|
no es necesaria para proteger contra ataques XXE.
|
|
</para>
|
|
</sect2>
|
|
|
|
<sect2 xml:id="migration80.deprecated.pgsql">
|
|
<title>PGSQL / PDO PGSQL</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
La constante <constant>PGSQL_LIBPQ_VERSION_STR</constant> ahora tiene el mismo valor que
|
|
<constant>PGSQL_LIBPQ_VERSION</constant>, y por lo tanto está obsoleta.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
Los alias de funciones en la extensión pgsql han sido desaprobados.
|
|
Consulte la siguiente lista para saber qué funciones deben usarse en su lugar:
|
|
</para>
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_errormessage</function> → <function>pg_last_error</function></member>
|
|
<member><function>pg_numrows</function> → <function>pg_num_rows</function></member>
|
|
<member><function>pg_numfields</function> → <function>pg_num_fields</function></member>
|
|
<member><function>pg_cmdtuples</function> → <function>pg_affected_rows</function></member>
|
|
<member><function>pg_fieldname</function> → <function>pg_field_name</function></member>
|
|
<member><function>pg_fieldsize</function> → <function>pg_field_size</function></member>
|
|
<member><function>pg_fieldtype</function> → <function>pg_field_type</function></member>
|
|
<member><function>pg_fieldnum</function> → <function>pg_field_num</function></member>
|
|
<member><function>pg_result</function> → <function>pg_fetch_result</function></member>
|
|
<member><function>pg_fieldprtlen</function> → <function>pg_field_prtlen</function></member>
|
|
<member><function>pg_fieldisnull</function> → <function>pg_field_is_null</function></member>
|
|
<member><function>pg_freeresult</function> → <function>pg_free_result</function></member>
|
|
<member><function>pg_getlastoid</function> → <function>pg_last_oid</function></member>
|
|
<member><function>pg_locreate</function> → <function>pg_lo_create</function></member>
|
|
<member><function>pg_lounlink</function> → <function>pg_lo_unlink</function></member>
|
|
<member><function>pg_loopen</function> → <function>pg_lo_open</function></member>
|
|
<member><function>pg_loclose</function> → <function>pg_lo_close</function></member>
|
|
<member><function>pg_loread</function> → <function>pg_lo_read</function></member>
|
|
<member><function>pg_lowrite</function> → <function>pg_lo_write</function></member>
|
|
<member><function>pg_loreadall</function> → <function>pg_lo_read_all</function></member>
|
|
<member><function>pg_loimport</function> → <function>pg_lo_import</function></member>
|
|
<member><function>pg_loexport</function> → <function>pg_lo_export</function></member>
|
|
<member><function>pg_setclientencoding</function> → <function>pg_set_client_encoding</function></member>
|
|
<member><function>pg_clientencoding</function> -> <function>pg_client_encoding</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
|
|
<sect2 xml:id="migration80.deprecated.standard">
|
|
<title>Biblioteca estándar</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
Las funciones de comparación para ordenamiento que devuelven &true; o &false; ahora emitirán una advertencia de obsolescencia, y
|
|
deberían ser reemplazadas por una implementación que devuelva un entero menor, igual o mayor
|
|
que cero.
|
|
</para>
|
|
<para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// Replace
|
|
usort($array, fn($a, $b) => $a > $b);
|
|
// With
|
|
usort($array, fn($a, $b) => $a <=> $b);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
|
|
<sect2 xml:id="migration80.deprecated.zip">
|
|
<title>Zip</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
El uso de un archivo vacío como ZipArchive está obsoleto. Libzip 1.6.0 ya no acepta archivos vacíos como
|
|
archivos zip válidos. La solución alternativa existente será eliminada en la próxima versión.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
La API procedural de Zip está obsoleta. Use <classname>ZipArchive</classname> en su lugar.
|
|
La iteración sobre todas las entradas puede realizarse usando <methodname>ZipArchive::statIndex</methodname>
|
|
y un bucle <link linkend="control-structures.for">for</link>:
|
|
</para>
|
|
<para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// iterate using the procedural API
|
|
assert(is_resource($zip));
|
|
while ($entry = zip_read($zip)) {
|
|
echo zip_entry_name($entry);
|
|
}
|
|
|
|
// iterate using the object-oriented API
|
|
assert($zip instanceof ZipArchive);
|
|
for ($i = 0; $entry = $zip->statIndex($i); $i++) {
|
|
echo $entry['name'];
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect2>
|
|
|
|
<sect2 xml:id="migration80.deprecated.reflection">
|
|
<title>Reflexión</title>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
<methodname>ReflectionFunction::isDisabled</methodname> está obsoleto, ya que ya no es posible
|
|
crear un <classname>ReflectionFunction</classname> para una función deshabilitada. Este
|
|
método ahora siempre devuelve &false;.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<methodname>ReflectionParameter::getClass</methodname>,
|
|
<methodname>ReflectionParameter::isArray</methodname> y
|
|
<methodname>ReflectionParameter::isCallable</methodname> están obsoletos.
|
|
En su lugar deberían usarse <methodname>ReflectionParameter::getType</methodname> y las
|
|
API de <classname>ReflectionType</classname>.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</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
|
|
-->
|