<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration72.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'migration72.incompatible.php',
    1 => 'Cambios incompatibles con versiones anteriores',
    2 => 'Cambios incompatibles con versiones anteriores',
  ),
  'up' => 
  array (
    0 => 'migration72.php',
    1 => 'Migraci&oacute;n de PHP 7.1.x a PHP 7.2.x',
  ),
  'prev' => 
  array (
    0 => 'migration72.constants.php',
    1 => 'Nuevas constantes globales',
  ),
  'next' => 
  array (
    0 => 'migration72.deprecated.php',
    1 => 'Funcionalidades obsoletas en PHP 7.2.x',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'appendices/migration72/incompatible.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="migration72.incompatible" class="sect1">
 <h2 class="title">Cambios incompatibles con versiones anteriores</h2>

 <div class="sect2" id="migration72.incompatible.number_format-no-neg-zero">
  <h3 class="title">Evitar que <span class="function"><a href="function.number-format.php" class="function">number_format()</a></span> devuelva cero negativo</h3>

  <p class="para">
   Anteriormente, era posible que la función
   <span class="function"><a href="function.number-format.php" class="function">number_format()</a></span> devolviera <code class="literal">-0</code>.
   Aunque esto es perfectamente válido según la norma &quot;IEEE 754
   floating point specification&quot;, esta rareza no era deseable
   para la visualización de números formateados en una forma legible por el ser humano.
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">number_format</span><span style="color: #007700">(-</span><span style="color: #0000BB">0.01</span><span style="color: #007700">)); </span><span style="color: #FF8000">// ahora muestra string(1) "0" en lugar de string(2) "-0"</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect2" id="migration72.incompatible.object-array-casts">
  <h3 class="title">Conversión de claves numéricas en objetos y arrays durante el casting</h3>

  <p class="para">
   Las claves numéricas ahora son mejor manejadas durante el casting
   de un array a un objeto y de un objeto a un array (casting explícito o por
   la función <span class="function"><a href="function.settype.php" class="function">settype()</a></span>).
  </p>

  <p class="para">
   Esto significa que las claves representadas por un entero (o un entero en forma de texto) de un array convertido en objeto ahora son accesibles:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// array a objeto<br /></span><span style="color: #0000BB">$arr </span><span style="color: #007700">= [</span><span style="color: #0000BB">0 </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">$obj </span><span style="color: #007700">= (object) </span><span style="color: #0000BB">$arr</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$obj</span><span style="color: #007700">,<br />    </span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;{</span><span style="color: #DD0000">'0'</span><span style="color: #007700">}, </span><span style="color: #FF8000">// ahora accesible<br />    </span><span style="color: #0000BB">$obj</span><span style="color: #007700">-&gt;{</span><span style="color: #0000BB">0</span><span style="color: #007700">} </span><span style="color: #FF8000">// ahora accesible<br /></span><span style="color: #007700">);</span></span></code></div>
   </div>

   <p class="para">El ejemplo anterior mostrará:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
object(stdClass)#1 (1) {
  [&quot;0&quot;]=&gt;    // ahora clave de texto en lugar de clave entera
  int(1)
}
int(1)
int(1)
</pre></div>
   </div>
  </div>

  <p class="para">
   Y las claves en formato entero (o entero en forma de texto) de objetos convertidos
   en arrays ahora son accesibles:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// objeto a array<br /></span><span style="color: #0000BB">$obj </span><span style="color: #007700">= new class {<br />    public function </span><span style="color: #0000BB">__construct</span><span style="color: #007700">()<br />    {<br />        </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;{</span><span style="color: #0000BB">0</span><span style="color: #007700">} = </span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />    }<br />};<br /></span><span style="color: #0000BB">$arr </span><span style="color: #007700">= (array) </span><span style="color: #0000BB">$obj</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$arr</span><span style="color: #007700">,<br />    </span><span style="color: #0000BB">$arr</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">], </span><span style="color: #FF8000">// ahora accesible<br />    </span><span style="color: #0000BB">$arr</span><span style="color: #007700">[</span><span style="color: #DD0000">'0'</span><span style="color: #007700">] </span><span style="color: #FF8000">// ahora accesible<br /></span><span style="color: #007700">);</span></span></code></div>
   </div>

   <p class="para">El ejemplo anterior mostrará:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(1) {
  [0]=&gt;    // ahora clave entera en lugar de clave de texto
  int(1)
}
int(1)
int(1)
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect2" id="migration72.incompatible.no-null-to-get_class">
  <h3 class="title">Prohibir pasar <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> a <span class="function"><a href="function.get-class.php" class="function">get_class()</a></span></h3>

  <p class="para">
   Anteriormente, pasar <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> a la función <span class="function"><a href="function.get-class.php" class="function">get_class()</a></span>
   devolvía el nombre de la clase en curso. Este comportamiento ha sido eliminado,
   se muestra un error <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> en su lugar.
   Para recuperar el mismo comportamiento que antes, el argumento debería
   simplemente ser eliminado.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.warn-on-non-countable-types">
  <h3 class="title">Advertir al contar tipos no contables</h3>

  <p class="para">
   Se emitirá un <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> al intentar
   utilizar la función <span class="function"><a href="function.count.php" class="function">count()</a></span> en un
   tipo no contable (esto incluye la función alias
   <span class="function"><a href="function.sizeof.php" class="function">sizeof()</a></span>).
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">null</span><span style="color: #007700">), </span><span style="color: #FF8000">// NULL no es contable<br />    </span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">), </span><span style="color: #FF8000">// un entero no es contable<br />    </span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #DD0000">'abc'</span><span style="color: #007700">), </span><span style="color: #FF8000">// un string no es contable<br />    </span><span style="color: #0000BB">count</span><span style="color: #007700">(new </span><span style="color: #0000BB">stdClass</span><span style="color: #007700">), </span><span style="color: #FF8000">// un objeto que no implementa la interfaz Countable no es contable<br />    </span><span style="color: #0000BB">count</span><span style="color: #007700">([</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">]) </span><span style="color: #FF8000">// un array es contable<br /></span><span style="color: #007700">);</span></span></code></div>
   </div>

   <p class="para">El ejemplo anterior mostrará:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d

Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
int(1)
int(1)
int(1)
int(2)
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect2" id="migration72.incompatible.hash-ext-to-objects">
  <h3 class="title">Reemplazo de ext/hash de recursos a objetos</h3>

  <p class="para">
   En el marco de la migración a largo plazo de los recursos, la extensión
   <a href="book.hash.php" class="link">Hash</a> ha sido actualizada para utilizar los
   objetos en lugar de recursos. El cambio debería ser transparente para
   los desarrolladores PHP, excepto donde se hayan realizado verificaciones con
   <span class="function"><a href="function.is-resource.php" class="function">is_resource()</a></span>
   (será necesario reemplazar por
   <span class="function"><a href="function.is-object.php" class="function">is_object()</a></span>).
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.ssl-tls-defaults">
  <h3 class="title">Mejorar los valores por defecto SSL/TLS</h3>

  <p class="para">
   Se han realizado las siguientes modificaciones respecto a los valores por defecto:
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <code class="literal">tls://</code> ahora por defecto TLSv1.0 o TLSv1.1 o TLSv1.2
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="literal">ssl://</code> es un alias de <code class="literal">tls://</code>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="literal">STREAM_CRYPTO_METHOD_TLS_*</code> constantes por defecto de
     TLSv1.0 o TLSv1.1 + TLSv1.2, en lugar de solo TLSv1.0.
    </span>
   </li>
  </ul>
 </div>

 <div class="sect2" id="migration72.incompatible.gettype-on-closed-resource">
  <h3 class="title"><span class="function"><a href="function.gettype.php" class="function">gettype()</a></span> valor de retorno en recursos cerrados</h3>

  <p class="para">
   Anteriormente, el uso de <span class="function"><a href="function.gettype.php" class="function">gettype()</a></span> en un recurso
   cerrado devolvía una cadena <code class="literal">&quot;unknown type&quot;</code>. Ahora,
   la cadena <code class="literal">&quot;resource (closed)&quot;</code> será devuelta.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.is_object-on-incomplete_class">
  <h3 class="title"><span class="function"><a href="function.is-object.php" class="function">is_object()</a></span> y <span class="classname"><a href="class.php-incomplete-class.php" class="classname">__PHP_Incomplete_Class</a></span></h3>

  <p class="para">
   Anteriormente, el uso de <span class="function"><a href="function.is-object.php" class="function">is_object()</a></span> en la clase
   <span class="classname"><a href="class.php-incomplete-class.php" class="classname">__PHP_Incomplete_Class</a></span> devolvía <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
   Ahora, <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> será devuelto.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.undefined-constants">
  <h3 class="title">Aumento del nivel de error de las constantes no definidas</h3>

  <p class="para">
   Las referencias no cualificadas a constantes no definidas ahora generarán
   un <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> (en lugar de un <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong>).
   En la próxima versión mayor de PHP, generarán una excepción
   <span class="classname"><a href="class.error.php" class="classname">Error</a></span>.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.windows-support">
  <h3 class="title">Soporte de Windows</h3>

  <p class="para">
   Las versiones mínimas oficialmente soportadas para Windows son Windows 7/
   Server 2008 R2.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.trait-properties">
  <h3 class="title">Verificación de los valores por defecto de las propiedades de los traits</h3>

  <p class="para">
   Los controles de compatibilidad en los valores por defecto de las propiedades de trait ya no realizarán la conversión.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.object-reserved-word">
  <h3 class="title"><code class="literal">object</code> para los nombres de clases</h3>

  <p class="para">
   El nombre <code class="literal">object</code> estaba anteriormente soft-reservado en PHP 7.0.
   Ahora está reservado, prohibiendo su uso como nombre de clase, trait o interfaz.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.netware-support">
  <h3 class="title">Soporte de NetWare</h3>

  <p class="para">
   El soporte de NetWare ha sido eliminado.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.array-unique">
  <h3 class="title"><span class="function"><a href="function.array-unique.php" class="function">array_unique()</a></span> con <strong><code><a href="array.constants.php#constant.sort-string">SORT_STRING</a></code></strong></h3>

  <p class="para">
   Mientras que <span class="function"><a href="function.array-unique.php" class="function">array_unique()</a></span> con <strong><code><a href="array.constants.php#constant.sort-string">SORT_STRING</a></code></strong>
   anteriormente copiaba el array y eliminaba elementos no únicos
   (sin envolver el array después), ahora se construye un nuevo array añadiendo los elementos únicos.
   Esto puede resultar en índices numéricos diferentes.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.bcmod-and-floats">
  <h3 class="title"><span class="function"><a href="function.bcmod.php" class="function">bcmod()</a></span> cambia para números decimales</h3>

  <p class="para">
   La función <span class="function"><a href="function.bcmod.php" class="function">bcmod()</a></span> ya no trunca los números
   fraccionarios a enteros. Como tal, su comportamiento ahora sigue
   <span class="function"><a href="function.fmod.php" class="function">fmod()</a></span>, en lugar del operador <code class="literal">%</code>.
   Por ejemplo, <code class="literal">bcmod(&#039;4&#039;, &#039;3.5&#039;)</code> ahora devuelve
   <code class="literal">0.5</code> en lugar de <code class="literal">1</code>.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.hash-functions">
  <h3 class="title">Funciones de hachage y hachages no criptográficos</h3>

  <p class="para">
   Las funciones <span class="function"><a href="function.hash-hmac.php" class="function">hash_hmac()</a></span>, <span class="function"><a href="function.hash-hmac-file.php" class="function">hash_hmac_file()</a></span>,
   <span class="function"><a href="function.hash-pbkdf2.php" class="function">hash_pbkdf2()</a></span>, y <span class="function"><a href="function.hash-init.php" class="function">hash_init()</a></span> (con
   <strong><code><a href="hash.constants.php#constant.hash-hmac">HASH_HMAC</a></code></strong>) ya no aceptan hachages no criptográficos.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.json_decode-changes">
  <h3 class="title">Opciones de la función <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span></h3>

  <p class="para">
   La opción <strong><code><a href="json.constants.php#constant.json-object-as-array">JSON_OBJECT_AS_ARRAY</a></code></strong> de la función
   <span class="function"><a href="function.json-decode.php" class="function">json_decode()</a></span> ahora se utiliza si el segundo parámetro
   (assoc) es <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>. Anteriormente <strong><code><a href="json.constants.php#constant.json-object-as-array">JSON_OBJECT_AS_ARRAY</a></code></strong> siempre fue ignorado.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.rand-mt_rand-output">
  <h3 class="title">Salida de <span class="function"><a href="function.rand.php" class="function">rand()</a></span> y <span class="function"><a href="function.mt-rand.php" class="function">mt_rand()</a></span></h3>

  <p class="para">
   Las secuencias generadas por <span class="function"><a href="function.rand.php" class="function">rand()</a></span> y
   <span class="function"><a href="function.mt-rand.php" class="function">mt_rand()</a></span> para casos específicos pueden diferir
   de PHP 7.1 en máquinas de 64 bits (debido a la corrección de un error
   en la implementación de la polarización del módulo).
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.sqlsafe_mode-ini-setting">
  <h3 class="title">Eliminación del parámetro INI <a href="ini.core.php#ini.sql.safe-mode" class="link"><code class="parameter">sql.safe_mode</code></a></h3>

  <p class="para">
   El parámetro INI <code class="parameter">sql.safe_mode</code> ha sido eliminado.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.date_parse_from_format">
  <h3 class="title">Cambio en <span class="function"><a href="function.date-parse.php" class="function">date_parse()</a></span> y <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span></h3>

  <p class="para">
   El elemento de <code class="literal">zone</code> del array devuelto por <span class="function"><a href="function.date-parse.php" class="function">date_parse()</a></span> y
   <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span> representa segundos en lugar de
   minutos, y su signo está invertido. Por ejemplo, <code class="literal">-120</code> ahora es
   <code class="literal">7200</code>.
  </p>
 </div>

 <div class="sect2" id="migration72.incompatible.cookie-decode">
  <h3 class="title">Cookies entrantes</h3>

  <p class="para">
   Desde PHP 7.2.34, los <em>nombres</em> de las cookies entrantes ya no
   se decodifican URL por razones de seguridad.
  </p>
 </div>
</div><?php manual_footer($setup); ?>