mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
424 lines
12 KiB
XML
424 lines
12 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 6a52dd81e3f791065b4b65a68d393012a7fdd858 Maintainer: ae Status: ready --><!-- CREDITS: fabioluciano,adiel,geekcom,ae -->
|
|
|
|
<sect2 xml:id="migration70.incompatible.other">
|
|
<title>Outras mudanças incompatíveis com versões anteriores</title>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.new-by-ref">
|
|
<title>Novos objetos não podem ser atribuídos por referência</title>
|
|
|
|
<para>
|
|
O resultado da declaração &new; não pode mais ser atribuído a uma variável
|
|
por referência:
|
|
</para>
|
|
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class C {}
|
|
$c =& new C;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.5;
|
|
<screen>
|
|
<![CDATA[
|
|
Deprecated: Assigning the return value of new by reference is deprecated in /tmp/test.php on line 3
|
|
]]>
|
|
</screen>
|
|
&example.outputs.7;
|
|
<screen>
|
|
<![CDATA[
|
|
Parse error: syntax error, unexpected 'new' (T_NEW) in /tmp/test.php on line 3
|
|
]]>
|
|
</screen>
|
|
</informalexample>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.classes">
|
|
<title>Nomes inválidos de classes, interfaces e traits</title>
|
|
|
|
<para>
|
|
Os nomes a seguir não podem ser utilizados como nome de classes, interfaces ou traits:
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><type>bool</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><type>int</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><type>float</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><type>string</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>&null;</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>&true;</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>&false;</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
|
|
<para>
|
|
Além disso, os seguintes nomes não devem ser usados. Embora eles não geram
|
|
um erro no PHP 7.0, eles são reservados para uso futuro e devem ser
|
|
considerados descontinuados.
|
|
</para>
|
|
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara><type>resource</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><type>object</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><type>mixed</type></simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara><type>numeric</type></simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.php-tags">
|
|
<title>Tags ASP e script removidas</title>
|
|
|
|
<para>
|
|
O suporte ao uso das tags ASP e script para delimitar o código PHP foi removido.
|
|
As tags afetadas são:
|
|
</para>
|
|
|
|
<table>
|
|
<title>Tags ASP e script removidas</title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>Tag de abertura</entry>
|
|
<entry>Tag de fechamento</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry><code><%</code></entry>
|
|
<entry><code>%></code></entry>
|
|
</row>
|
|
<row>
|
|
<entry><code><%=</code></entry>
|
|
<entry><code>%></code></entry>
|
|
</row>
|
|
<row>
|
|
<entry><code><script language="php"></code></entry>
|
|
<entry><code></script></code></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.incompatible-this">
|
|
<title>Chamadas de contextos incompatíveis foram removidas</title>
|
|
|
|
<para>
|
|
<link linkend="migration56.deprecated.incompatible-context">Anteriormente descontinuadas no PHP 5.6</link>,
|
|
chamadas estáticas feitas a métodos não-estáticos com um contexto incompatível agora
|
|
resultarão no método chamado tendo uma variável
|
|
<literal>$this</literal> indefinida e um aviso de descontinuação será emitido.
|
|
</para>
|
|
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class A {
|
|
public function test() { var_dump($this); }
|
|
}
|
|
|
|
// Nota: NÃO estende A
|
|
class B {
|
|
public function callNonStaticMethodOfA() { A::test(); }
|
|
}
|
|
|
|
(new B)->callNonStaticMethodOfA();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.56;
|
|
<screen>
|
|
<![CDATA[
|
|
Deprecated: Non-static method A::test() should not be called statically, assuming $this from incompatible context in /tmp/test.php on line 8
|
|
object(B)#1 (0) {
|
|
}
|
|
]]>
|
|
</screen>
|
|
&example.outputs.7;
|
|
<screen>
|
|
<![CDATA[
|
|
Deprecated: Non-static method A::test() should not be called statically in /tmp/test.php on line 8
|
|
|
|
Notice: Undefined variable: this in /tmp/test.php on line 3
|
|
NULL
|
|
]]>
|
|
</screen>
|
|
</informalexample>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.yield">
|
|
<title>&yield; agora é um operador associativo à direita</title>
|
|
|
|
<para>
|
|
O construtor &yield; não requer mais o uso de parênteses e foi alterado
|
|
para um operador associativo à direita com precedência entre
|
|
<literal>print</literal> e <literal>=></literal>. Isso pode resultar em um
|
|
comportamento alterado:
|
|
</para>
|
|
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo yield -1;
|
|
// Era interpretado como
|
|
echo (yield) - 1;
|
|
// E agora é interpretado como
|
|
echo yield (-1);
|
|
|
|
yield $foo or die;
|
|
// Era interpretado como
|
|
yield ($foo or die);
|
|
// E agora é interpretado como
|
|
(yield $foo) or die;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
|
|
<para>
|
|
Parênteses podem ser utilizados para remover a ambiguidade nestes casos.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.func-parameters">
|
|
<title>Funções não podem ter vários parâmetros com o mesmo nome</title>
|
|
|
|
<para>
|
|
Não é mais possível definir dois ou mais parâmetros em uma função com o
|
|
mesmo nome. Por exemplo, a função a seguir vai disparar um
|
|
<constant>E_COMPILE_ERROR</constant>:
|
|
</para>
|
|
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function foo($a, $b, $unused, $unused) {
|
|
//
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.func-parameter-modified">
|
|
<title>Funções inspecionando argumentos informam o valor <emphasis>atual</emphasis> do parâmetro</title>
|
|
|
|
<para>
|
|
<function>func_get_arg</function>, <function>func_get_args</function>,
|
|
<function>debug_backtrace</function> e backtraces de exceção não
|
|
informam mais o valor original que foi passado para um parâmetro, mas ao invés disso, irão
|
|
informar o valor atual (que pode ter sido modificado).
|
|
</para>
|
|
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function foo($x) {
|
|
$x++;
|
|
var_dump(func_get_arg(0));
|
|
}
|
|
foo(1);?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.5;
|
|
<screen>
|
|
<![CDATA[
|
|
1
|
|
]]>
|
|
</screen>
|
|
&example.outputs.7;
|
|
<screen>
|
|
<![CDATA[
|
|
2
|
|
]]>
|
|
</screen>
|
|
</informalexample>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.multiple-default">
|
|
<title>Declarações switch não podem ter vários blocos default</title>
|
|
|
|
<para>
|
|
Não é mais possível definir dois ou mais blocos default em uma declaração
|
|
switch. Por exemplo, a declaração switch a seguir irá disparar um
|
|
<constant>E_COMPILE_ERROR</constant>:
|
|
</para>
|
|
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
switch (1) {
|
|
default:
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.http-raw-post-data">
|
|
<title><varname>$HTTP_RAW_POST_DATA</varname> removida</title>
|
|
|
|
<para>
|
|
A variável <varname>$HTTP_RAW_POST_DATA</varname> não está mais disponível. Ao invés
|
|
disso o fluxo <link linkend="wrappers.php.input"><literal>php://input</literal></link>
|
|
deve ser utilizado.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.ini-comments">
|
|
<title>Comentários iniciados com <literal>#</literal> nos arquivos INI foram removidos</title>
|
|
|
|
<para>
|
|
O suporte a comentários prefixados com <literal>#</literal> nos arquivos INI foi
|
|
removido. Em vez disso, o <literal>;</literal> (ponto-e-vírgula) deve ser usado. Esta mudança
|
|
aplica-se ao &php.ini;, assim como aos arquivos manipulados pelas funções
|
|
<function>parse_ini_file</function> e <function>parse_ini_string</function>.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.json-to-jsond">
|
|
<title>Substituição da extensão JSON por JSOND</title>
|
|
|
|
<para>
|
|
A extensão JSON foi substituída por JSOND, causando três quebras menores de compatibilidade com versões
|
|
anteriores. Em primeiro lugar, um número não pode ser terminado em um ponto decimal (isto é,
|
|
<literal>34.</literal> deve ser modificado para <literal>34.0</literal> ou
|
|
<literal>34</literal>). Em segundo lugar, ao usar notação científica, o
|
|
expoente <literal>e</literal> não deve seguir imediatamente o ponto decimal
|
|
(isto é, <literal>3.e3</literal> deve ser modificado para
|
|
<literal>3.0e3</literal> ou <literal>3e3</literal>).
|
|
Finalmente, uma string vazia não é mais considerada JSON válido.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.internal-function-failure-overflow">
|
|
<title>Função interna falha em caso de estouro</title>
|
|
|
|
<para>
|
|
Antes, funções internas silenciosamente truncavam números produzidos por
|
|
coerções de pontos flutuantes para inteiros quando o ponto flutuante era grande demais para ser representado como um
|
|
inteiro. Agora um E_WARNING será emitido e &null; será retornado.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.fixes-custom-session-handler">
|
|
<title>Ajustes nos valores retornados pelo manipulador de sessão customizado</title>
|
|
|
|
<para>
|
|
Quaisquer funções de predicado implementadas por manipuladores de sessões customizadas que retornem
|
|
&false; ou <literal>-1</literal> resultarão em erros fatais. Se qualquer valor retornado
|
|
destas funções não é um booleano, <literal>-1</literal> ou
|
|
<literal>0</literal>, então ela irá falhar e um E_WARNING será
|
|
emitido.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.sort-order">
|
|
<title>Ordenações de elementos iguais</title>
|
|
<para>
|
|
O algoritmo interno de ordenação foi melhorado, o que pode resultar em
|
|
diferentes ordenações de elementos, que são comparados como iguais, do que antes.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Não confie na ordem de elementos que são comparados como iguais; ela pode mudar
|
|
a qualquer momento.
|
|
</para>
|
|
</note>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.break-continue">
|
|
<title>Instruções break e continue deslocadas</title>
|
|
<para>
|
|
As declarações <literal>break</literal> e <literal>continue</literal> fora de um
|
|
laço ou de uma estrutura de controle <literal>switch</literal>, agora são detectados em
|
|
tempo de compilação em vez de tempo de execução como antes, e dispara um erro
|
|
<constant>E_COMPILE_ERROR</constant>.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.break-continue-constant">
|
|
<title>Constante não permitida como argumento de break e continue</title>
|
|
<para>
|
|
As instruções <literal>break</literal> e <literal>continue</literal> não mais
|
|
permitem que seus argumentos sejam uma constante, e emitem um
|
|
<constant>E_COMPILE_ERROR</constant>.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.mhash">
|
|
<title>Mhash não é mais uma extensão</title>
|
|
<para>
|
|
A extensão Mhash foi completamente integrada na extensão <link
|
|
linkend="book.hash">Hash</link>. Portanto, não é mais
|
|
possível detectar o suporte à extensão Mhash com <function>extension_loaded</function>;
|
|
em vez disso use <function>function_exists</function>. Além disso, Mhash não é mais
|
|
informada por <function>get_loaded_extensions</function> e recursos
|
|
relacionados.
|
|
</para>
|
|
</sect3>
|
|
|
|
<sect3 xml:id="migration70.incompatible.other.declare-ticks">
|
|
<title>declare(ticks)</title>
|
|
<para>
|
|
A diretiva <link linkend="control-structures.declare.ticks">declare(ticks)</link>
|
|
não vaza mais para diferentes unidades de compilação.
|
|
</para>
|
|
</sect3>
|
|
</sect2>
|
|
|
|
<!-- 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
|
|
-->
|