mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
partial migration70 translation
git-svn-id: https://svn.php.net/repository/phpdoc/pt_BR/trunk@338683 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
64
appendices/migration70.xml
Normal file
64
appendices/migration70.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 8cc279c18a78d76f098a0dc5af3101f6e8f5fd7e Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
<!--
|
||||
Work in progress!
|
||||
-->
|
||||
|
||||
<appendix xml:id="migration70" xmlns="http://docbook.org/ns/docbook" xmlns:phd="http://www.php.net/ns/phd">
|
||||
<title>Migrando do PHP 5.6.x para o PHP 7.0.x</title>
|
||||
|
||||
&appendices.migration70.incompatible;
|
||||
&appendices.migration70.new-features;
|
||||
&appendices.migration70.deprecated;
|
||||
&appendices.migration70.changed-functions;
|
||||
&appendices.migration70.new-functions;
|
||||
&appendices.migration70.classes;
|
||||
&appendices.migration70.constants;
|
||||
&appendices.migration70.sapi-changes;
|
||||
&appendices.migration70.removed-exts-sapis;
|
||||
&appendices.migration70.other-changes;
|
||||
|
||||
<sect1 phd:chunk="false" xml:id="migration70.intro">
|
||||
<para>
|
||||
Apesar do fato do PHP 7.0 ser uma versão maior, esforços foram feitos para que a migração
|
||||
seja de forma mais simples possível.
|
||||
Esta versão se concentra principalmente na remoção de funcionalidades depreciadas em versões anteriores e na melhoria da consistênciada da linguagem.
|
||||
</para>
|
||||
<para>
|
||||
Existem <link linkend="migration70.incompatible">algumas incompatibilidades</link> e <link linkend="migration70.new-features">novos recursos</link> que devem ser considerados, e o código deve ser testado antes de trocar a versão do PHP em
|
||||
ambientes de produção.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
&manual.migration.seealso;
|
||||
<link linkend="migration5">5.0.x</link>,
|
||||
<link linkend="migration51">5.1.x</link>,
|
||||
<link linkend="migration52">5.2.x</link>,
|
||||
<link linkend="migration53">5.3.x</link>,
|
||||
<link linkend="migration54">5.4.x</link>,
|
||||
<link linkend="migration55">5.5.x</link> e
|
||||
<link linkend="migration56">5.6.x</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
</appendix>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
101
appendices/migration70/changed-functions.xml
Normal file
101
appendices/migration70/changed-functions.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: faf9214032e40c894089c363da03d5bc4113f217 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect1 xml:id="migration70.changed-functions">
|
||||
<title>Funções modificadas</title>
|
||||
|
||||
<sect2 xml:id="migration70.changed-functions.core">
|
||||
<title>Núcleo do PHP</title>
|
||||
<!--
|
||||
Let's assume that functions from extensions bundled by default with PHP are 'core functions',
|
||||
like in PHP 5.6.x migration guide.
|
||||
-->
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>debug_zval_dump</function> agora imprime "int" ao invés de "long"
|
||||
e "float" ao invés de "double"
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>dirname</function> agora têm um segundo parâmetro opcional,
|
||||
<parameter>profundidade</parameter>, para recuperar o nome do diretório do
|
||||
nível de <parameter>profundidade</parameter> acima do diretório corrente.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>getrusage</function> agora têm suporte no Windows.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
As funções <function>mktime</function> e <function>gmmktime</function>
|
||||
não aceitam mais o parâmetro <parameter>is_dst</parameter>(é horário de verão).
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
A função <function>preg_replace</function> não têm mais suporte ao modificador
|
||||
"\e" (<constant>PREG_REPLACE_EVAL</constant>). Em vez disso, a função <function>preg_replace_callback</function>
|
||||
deve ser usada.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
A função <function>setlocale</function> não aceita mais o parâmetro <parameter>categoria</parameter>
|
||||
passado como string. Em vez disso, as constantes <constant>LC_*</constant> devem ser utilizada.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
As funções <function>exec</function>, <function>system</function> e <function>passthru</function>
|
||||
agora possuem proteção contro bytes nulos.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
A função <function>substr</function> agora retorna uma string vazia, caso
|
||||
a string seja igual ao início dos caracteres.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<!-- skeleton; replace ext with extension name
|
||||
<sect2 xml:id="migration70.changed-functions.ext">
|
||||
<title><link linkend="book.ext">ext</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Change.
|
||||
</simpara>
|
||||
</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
|
||||
-->
|
||||
112
appendices/migration70/classes.xml
Normal file
112
appendices/migration70/classes.xml
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 3906d95218c8b4b1ce3fb57f81d0e7b3786794f6 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect1 xml:id="migration70.classes" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Novas Classes e Interfaces</title>
|
||||
|
||||
<sect2 xml:id="migration70.classes.intl">
|
||||
<title><link linkend="book.intl">Intl</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>IntlChar</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.classes.reflection">
|
||||
<title><link linkend="book.reflection">Reflexão</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>ReflectionGenerator</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>ReflectionType</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.classes.session">
|
||||
<title><link linkend="book.session">Manipulação de Sessão</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>SessionUpdateTimestampHandlerInterface</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.classes.exception-hierarchy">
|
||||
<title>Hierarquia de Exceções</title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>Throwable</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>Error</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>TypeError</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>ParseError</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>AssertionError</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>ArithmeticError</classname>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<classname>DivisionByZeroError</classname>
|
||||
</simpara>
|
||||
</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
|
||||
-->
|
||||
192
appendices/migration70/constants.xml
Normal file
192
appendices/migration70/constants.xml
Normal file
@@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 3906d95218c8b4b1ce3fb57f81d0e7b3786794f6 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect1 xml:id="migration70.constants" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Novas Constantes Globais</title>
|
||||
|
||||
<sect2 xml:id="migration70.constants.core">
|
||||
<title><link linkend="reserved.constants">Constantes Predefinidas do Núcleo</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>PHP_INT_MIN</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.constants.libxml">
|
||||
<title><link linkend="book.libxml">LibXML</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>LIBXML_BIGLINES</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.constants.pcre">
|
||||
<title><link linkend="book.pcre">PCRE</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>PREG_JIT_STACKLIMIT_ERROR</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.constants.posix">
|
||||
<title><link linkend="book.posix">POSIX</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_AS</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_CORE</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_CPU</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_DATA</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_FSIZE</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_LOCKS</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_MEMLOCK</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_MSGQUEUE</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_NICE</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_NOFILE</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_NPROC</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_RSS</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_RTPRIO</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_RTTIME</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_SIGPENDING</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_STACK</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>POSIX_RLIMIT_INFINITY</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.constants.zlib">
|
||||
<title><link linkend="book.zlib">Zlib</link></title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>ZLIB_BLOCK</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>ZLIB_FINISH</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>ZLIB_FULL_FLUSH</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>ZLIB_NO_FLUSH</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>ZLIB_PARTIAL_FLUSH</constant>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<constant>ZLIB_SYNC_FLUSH</constant>
|
||||
</simpara>
|
||||
</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
|
||||
-->
|
||||
36
appendices/migration70/incompatible.xml
Normal file
36
appendices/migration70/incompatible.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 98811e1fcb908d594d0cd03477be1e4b4d0f8ea4 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect1 xml:id="migration70.incompatible">
|
||||
<title>Mudanças incompatíveis com versões anteriores</title>
|
||||
|
||||
&appendices.migration70.incompatible.error-handling;
|
||||
&appendices.migration70.incompatible.variable-handling;
|
||||
&appendices.migration70.incompatible.foreach;
|
||||
&appendices.migration70.incompatible.integers;
|
||||
&appendices.migration70.incompatible.strings;
|
||||
&appendices.migration70.incompatible.removed-functions;
|
||||
&appendices.migration70.incompatible.removed-ini-directives;
|
||||
&appendices.migration70.incompatible.other;
|
||||
</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
|
||||
-->
|
||||
168
appendices/migration70/incompatible/error-handling.xml
Normal file
168
appendices/migration70/incompatible/error-handling.xml
Normal file
@@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 44b298ee5daf7c79a8e63c7e80ffe65232822838 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.error-handling">
|
||||
<title>Modificações no trato de erros e exceções</title>
|
||||
|
||||
<para>
|
||||
Alguns erros fatais e recuperáveis foram convertidos para exceções no
|
||||
PHP 7. Estas exceções herdam a classe <classname>Error</classname>, que implementa a
|
||||
interface <classname>Throwable</classname> (a interface base que todas as exceções herdam).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Isso significa que manipuladores de erros podem não ser ativados porque
|
||||
exceções estão sendo disparadas em seu lugar (causando novos erros fatais por
|
||||
exceções <classname>Error</classname> não capturadas)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Uma descrição completa de como tratar erros no PHP 7 pode ser encontrada
|
||||
<link linkend="language.errors.php7">na página de erros do PHP 7</link>. Este
|
||||
guia de migração irá enumerar apenas as mudanças compativeis com versões
|
||||
anteriores.
|
||||
</para>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.error-handling.set-exception-handler">
|
||||
<title>
|
||||
<function>set_exception_handler</function> não têm mais garantias de
|
||||
receber um objeto do tipo <classname>Exception</classname>.
|
||||
</title>
|
||||
|
||||
<para>
|
||||
Códigos que implementam um manipulador de exceção registrado com
|
||||
<function>set_exception_handler</function> usando a declação de tipo
|
||||
<classname>Exception</classname> causará um erro fatal quando um objeto
|
||||
<classname>Error</classname> for lançado.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Se o manipulador precisa trabalhar com o PHP 5 e 7, você deve remover a
|
||||
declaração de tipo do manipulador, enquanto que o código a migrar
|
||||
para funcionar exclusivamente no PHP 7, pode simplesmente trocar a declaração de tipo
|
||||
<classname>Exception</classname> por
|
||||
<classname>Throwable</classname>.
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Código da era PHP 5 que não irá funcionar.
|
||||
function handler(Exception $e) { ... }
|
||||
set_exception_handler('handler');
|
||||
|
||||
// Compatível com PHP 5 e 7.
|
||||
function handler($e) { ... }
|
||||
|
||||
// Somente PHP 7.
|
||||
function handler(Throwable $e) { ... }
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.error-handling.constructors">
|
||||
<title>Contrutores internos sempre lançarão exceções em caso de falha</title>
|
||||
|
||||
<para>
|
||||
Anteriormente, algumas classes internas retornavam &null; ou um objeto inútil
|
||||
quando o contrutor falhava. Todas as classes internas agora lançam
|
||||
<classname>Exception</classname> neste caso, da mesma forma que
|
||||
classes de usuário já faziam.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.error-handling.parse">
|
||||
<title>Erros de Parse lançam exceções <classname>ParseError</classname></title>
|
||||
|
||||
<para>
|
||||
Erros de Parser agora lançam um objeto <classname>ParseError</classname>. Manipular
|
||||
erros da função <function>eval</function> devem incluir um bloco &catch;
|
||||
que possa manipular este erro.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.error-handling.strict">
|
||||
<title>Mudanças na serveridade de notificações E_STRICT</title>
|
||||
|
||||
<para>
|
||||
Todas as notificações <constant>E_STRICT</constant> foram reclassificadas para
|
||||
outros níveis. A constante <constant>E_STRICT</constant> foi mantida, então chamar
|
||||
<literal>error_reporting(E_ALL|E_STRICT)</literal> não causará um erro.
|
||||
</para>
|
||||
<para>
|
||||
<table>
|
||||
<title>Mudanças na serveridade de notificações <constant>E_STRICT</constant></title>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Situação</entry>
|
||||
<entry>Novo nível/Comportamento</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>Utilizar um recurso como índice</entry>
|
||||
<entry><constant>E_NOTICE</constant></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Métodos estáticos abstratos</entry>
|
||||
<entry>Notificação removida, não dispara erro</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>"Redefinindo" um construtor</entry>
|
||||
<entry>Notificação removida, não dispara erro</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Assinatura incompatível durante a herança</entry>
|
||||
<entry><constant>E_WARNING</constant></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Mesmas propriedades(compatíveis) em duas traits utilizadas</entry>
|
||||
<entry>Notificação removida, não dispara erro</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Acessando propriedades estáticas de forma não estática</entry>
|
||||
<entry><constant>E_NOTICE</constant></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Somente variáveis devem ser ser atribuídas por referência</entry>
|
||||
<entry><constant>E_NOTICE</constant></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Somente variáveis devem ser passadas por referência</entry>
|
||||
<entry><constant>E_NOTICE</constant></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>Chamando métodos não estáticos de forma estática</entry>
|
||||
<entry><constant>E_DEPRECATED</constant></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</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
|
||||
-->
|
||||
134
appendices/migration70/incompatible/foreach.xml
Normal file
134
appendices/migration70/incompatible/foreach.xml
Normal file
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: b7a780f8e762e290552b9f79d346f2bcbc272e0c Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.foreach">
|
||||
<title>Mudanças no &foreach;</title>
|
||||
|
||||
<para>
|
||||
Pequenas mudanças foram feitas no modo como a estrutura de controle &foreach;
|
||||
se comporta, principalmente na manipulação do ponteiro interno do array e
|
||||
modificações no array sendo iterado.
|
||||
</para>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.foreach.array-pointer">
|
||||
<title>&foreach; não modifica mais o ponteiro interno do array</title>
|
||||
|
||||
<para>
|
||||
Antes do PHP 7, o ponteiro interno do array era modificado enquanto o array
|
||||
era iterado usando o &foreach;. Este não é mais o caso, como mostrado
|
||||
nos exemplos a seguir:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$array = [0, 1, 2];
|
||||
foreach ($array as &$val) {
|
||||
var_dump(current($array));
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(1)
|
||||
int(2)
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(0)
|
||||
int(0)
|
||||
int(0)
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.foreach.by-value">
|
||||
<title>&foreach; por valor opera em uma cópia do array</title>
|
||||
|
||||
<para>
|
||||
Quando usado no modo padrão, por valor, o &foreach; vai operar em uma
|
||||
cópia do array sendo iterado, ao invés do próprio array. Isso significa
|
||||
que mudanças feitas durante a iteração do array, não afetarão os valores
|
||||
iterados.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.foreach.by-ref">
|
||||
<title>Melhora no comporatamento da iteração por referência com &foreach;</title>
|
||||
|
||||
<para>
|
||||
Quanto iterado por referencia, o &foreach; fará um melhor trabalho de
|
||||
controlar as alterações feitas ao array durante a iteração. Por exemplo,
|
||||
inclusões ao array enquanto iterado, agora resultam na inclusão de
|
||||
valores enquanto itera, como a seguir:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$array = [0];
|
||||
foreach ($array as &$val) {
|
||||
var_dump($val);
|
||||
$array[1] = 1;
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(0)
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(0)
|
||||
int(1)
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.foreach.object">
|
||||
<title>Iteração de objetos não <classname>Traversable</classname></title>
|
||||
|
||||
<para>
|
||||
Iterar objetos não <classname>Traversable</classname> agora
|
||||
têm o mesmo comportamento que iterar arrays por referência. Isso
|
||||
resulta na
|
||||
<link linkend="migration70.incompatible.foreach.by-ref">melhora do comportamento quando houver modificões no array durante a iteração</link>
|
||||
também aplicado quando propriedades são adicionadas ou removidas do
|
||||
objeto.
|
||||
</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
|
||||
-->
|
||||
128
appendices/migration70/incompatible/integers.xml
Normal file
128
appendices/migration70/incompatible/integers.xml
Normal file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: f410b1b23b6d3483e38b8c6f4c26e4d6c5cc39c7 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.integers">
|
||||
<title>Mudança na manipulação do <type>inteiro</type></title>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.integers.invalid-octals">
|
||||
<title>Octais literais inválidos</title>
|
||||
|
||||
<para>
|
||||
Antes, octais literais que continham números inválidos, eram silenciosamente
|
||||
truncados (<literal>0128</literal> se tornaria <literal>012</literal>).
|
||||
Agora, um octal literal inválido causará um erro de parse.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.integers.negative-bitshift">
|
||||
<title>Deslocamento de bits negativos</title>
|
||||
|
||||
<para>
|
||||
Deslocamento de bits por números negativos agora lançarão uma exceção
|
||||
<classname>ArithmeticError</classname>:
|
||||
</para>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
var_dump(1 >> -1);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(0)
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Fatal error: Uncaught ArithmeticError: Bit shift by negative number in /tmp/test.php:2
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in /tmp/test.php on line 2
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.integers.out-of-range">
|
||||
<title>Deslocamentos de bits fora do limite</title>
|
||||
|
||||
<para>
|
||||
Deslocamentos de bits (em ambas direções), além do tamanho de bits de um
|
||||
<type>inteiro</type> sempre resultará em 0. Antes, o comportamento
|
||||
do deslocamento dependia da arquitetura.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.integers.div-by-zero">
|
||||
<title>Mudanças na Divisão por Zero</title>
|
||||
|
||||
<para>
|
||||
Antes, quando 0 era usado como divisor tanto para a operador de divisão (/) quanto
|
||||
para o módulo, um E_WARNING era emitido e
|
||||
<constant>false</constant> era retornado. Agora, o operador de divisão
|
||||
retornará um float +INF, -INF ou NAN. O E_WARNING do operador módulo
|
||||
foi removido e irá lançar uma exceção <classname>DivisionByZeroError</classname>.
|
||||
</para>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
var_dump(3/0);
|
||||
var_dump(0/0);
|
||||
var_dump(0%0);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Warning: Division by zero in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: Division by zero in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: Division by zero in %s on line %d
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Warning: Division by zero in %s on line %d
|
||||
float(INF)
|
||||
|
||||
Warning: Division by zero in %s on line %d
|
||||
float(NAN)
|
||||
|
||||
PHP Fatal error: Uncaught DivisionByZeroError: Modulo by zero in %s line %d
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</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
|
||||
-->
|
||||
345
appendices/migration70/incompatible/other.xml
Normal file
345
appendices/migration70/incompatible/other.xml
Normal file
@@ -0,0 +1,345 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 8a4b3b6a355133da942aeec1ac739705ce2c4796 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<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 restultado 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>Classes inválidas e nomenclatura de 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 nomes a seguir não devem ser utilizados. Entretanto não será
|
||||
gerado nenhum erro no PHP 7.0, eles são reservados para uso futuro e devem ser
|
||||
considerados depreciados.
|
||||
</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 de 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 incopatíveis foram removidos</title>
|
||||
|
||||
<para>
|
||||
<link linkend="migration56.deprecated.incompatible-context">Depreciadas no PHP 5.6</link>,
|
||||
chamadas estáticas feitas em métodos não estáticos em um contexto incompatível irá
|
||||
resultar em chamar o método tendo a variável
|
||||
<literal>$this</literal> indefinida e um aviso de depreciação ser emitido.
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class A {
|
||||
public function test() { var_dump($this); }
|
||||
}
|
||||
|
||||
// Note: Does NOT extend A
|
||||
class B {
|
||||
public function callNonStaticMethodOfA() { A::test(); }
|
||||
}
|
||||
|
||||
(new B)->callNonStaticMethodOfA();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<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>O &yield; agora é um operador associativo à direta</title>
|
||||
|
||||
<para>
|
||||
Parênteses em chamadas ao construtor do &yield; não são mais necessários, além disso, foi
|
||||
modificados para ser um operador assoativo à direita com precedência entre
|
||||
<literal>print</literal> e <literal>=></literal>. Isso pode resultar em um
|
||||
comportamento diferenciado:
|
||||
</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>
|
||||
Parenteses podem ser utilizados para remover a ambiguidade entre estes 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.multiple-default">
|
||||
<title>Declarações switch não podem ter mais 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 vai 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 stream <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 prefixar comentários com <literal>#</literal> nos arquivos INI foi
|
||||
removido. Em vez disso, o <literal>;</literal> (ponto-e-vírgula) deve ser usado.
|
||||
Essa mudança aplica-se ao &php.ini;, assim como 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 substituida pela JSOND, que causa duas quebras no cálculo
|
||||
básico. 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, quando usada a notação científica, o
|
||||
expoente <literal>e</literal> não deve preceder exatamente o ponto decimal
|
||||
(isto é <literal>3.e3</literal> deve ser modificado para
|
||||
<literal>3.0e3</literal> ou <literal>3e3</literal>).
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.other.internal-function-failure-overflow">
|
||||
<title>Função interna de 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; retornado.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.other.fixes-custom-session-handler">
|
||||
<title>Ajustes aos valores retornados pelo manipular de sessão customizado</title>
|
||||
<para>
|
||||
Quaisquer funções implementadas por manipuladores de sessões que retornem &false;
|
||||
ou <literal>-1</literal> resultarão em erros fatais. Se qualquer valor retornado
|
||||
dessas funções não são um booleano, <literal>-1</literal>, ou <literal>0</literal>,
|
||||
então falhará e um E_WARNING será emitido.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.other.func-get-args-change">
|
||||
<title>
|
||||
As funções <function>func_get_arg</function> e <function>func_get_args</function>
|
||||
agora retornam os valores correntes dos argumentos
|
||||
</title>
|
||||
|
||||
<para>
|
||||
As funções <function>func_get_arg</function> e <function>func_get_args</function>
|
||||
anteriormente retornavam os valores originais do argumentos, mesmo depois de
|
||||
modificados. Agora, elas sempre retornam os valores correntes dos argumentos.
|
||||
</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
|
||||
-->
|
||||
152
appendices/migration70/incompatible/removed-functions.xml
Normal file
152
appendices/migration70/incompatible/removed-functions.xml
Normal file
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: b7a780f8e762e290552b9f79d346f2bcbc272e0c Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.removed-functions">
|
||||
<title>Funções removidas</title>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.call-user-method">
|
||||
<title>
|
||||
<function>call_user_method</function> e
|
||||
<function>call_user_method_array</function>
|
||||
</title>
|
||||
|
||||
<para>
|
||||
Estas funções foram depreciadas no PHP 4.1.0 em favor de
|
||||
<function>call_user_func</function> e
|
||||
<function>call_user_func_array</function>. Você também pode considerar usar
|
||||
<link linkend="functions.variable-functions">funções variáveis</link>
|
||||
e/ou o operador
|
||||
<link linkend="functions.variable-arg-list.new"><literal>...</literal></link>.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.mcrypt">
|
||||
<title>Sinônimos do <link linkend="book.mcrypt">mcrypt</link></title>
|
||||
|
||||
<para>
|
||||
A função depreciada <function>mcrypt_generic_end</function> foi
|
||||
removida em favor de <function>mcrypt_generic_deinit</function>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Adicionalmente, as funções depreciadas <function>mcrypt_ecb</function>,
|
||||
<function>mcrypt_cbc</function>, <function>mcrypt_cfb</function> e
|
||||
<function>mcrypt_ofb</function> foram removidas em favor do uso da função
|
||||
<function>mcrypt_decrypt</function> com o uso apropriado da constante
|
||||
<constant>MCRYPT_MODE_*</constant>.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.intl">
|
||||
<title>Sinônimos de <link linkend="book.intl">intl</link></title>
|
||||
|
||||
<para>
|
||||
Os sinônimos depreciados <function>datefmt_set_timezone_id</function> e
|
||||
<methodname>IntlDateFormatter::setTimeZoneID</methodname> foram
|
||||
removidos em favor de <function>datefmt_set_timezone</function> e
|
||||
<methodname>IntlDateFormatter::setTimeZone</methodname>, respectivamente.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.magic-quotes">
|
||||
<title><function>set_magic_quotes_runtime</function></title>
|
||||
|
||||
<para>
|
||||
<function>set_magic_quotes_runtime</function>, juntamente com seu sinônimo
|
||||
<function>magic_quotes_runtime</function>, foram removidas. Elas foram
|
||||
depreciadas no PHP 5.3.0, e se tornaram efetivamente não funcionais com
|
||||
a remoção das magic quotes
|
||||
<link linkend="migration54.incompatible">no PHP 5.4.0</link>.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.set-socket-blocking">
|
||||
<title><function>set_socket_blocking</function></title>
|
||||
|
||||
<para>
|
||||
O sinônimo depreciado <function>set_socket_blocking</function> foi
|
||||
removido em favor de <function>stream_set_blocking</function>.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.dl">
|
||||
<title><function>dl</function> no PHP-FPM</title>
|
||||
|
||||
<para>
|
||||
<function>dl</function> não pode ser mais utilizado no PHP-FPM. Permanece
|
||||
funcional na interface CLI e SAPIs embarcadas.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-functions.gd">
|
||||
<title>Funções <link linkend="book.image">GD</link> Type1</title>
|
||||
|
||||
<para>
|
||||
O suporte a fontes PostScript Type1 foi removido da extensão GD,
|
||||
resultando na remoção das seguintes funções:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepsbbox</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepsencodefont</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepsextendfont</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepsfreefont</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepsloadfont</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepsslantfont</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>imagepstext</function>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
O uso de fontes TruType e funções associadas é recomendado.
|
||||
</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
|
||||
-->
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: b7a780f8e762e290552b9f79d346f2bcbc272e0c Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.removed-ini-directives">
|
||||
<title>Diretivas INI removidas</title>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-ini-directives.features">
|
||||
<title>Recursos removidos</title>
|
||||
|
||||
<para>
|
||||
As diretivas INI a seguir foram removidas, assim como os como seus recursos
|
||||
associados:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="ini.always-populate-raw-post-data"><parameter>always_populate_raw_post_data</parameter></link>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<link linkend="ini.asp-tags"><parameter>asp_tags</parameter></link>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.removed-ini-directives.xsl">
|
||||
<title><parameter>xsl.security_prefs</parameter></title>
|
||||
|
||||
<para>
|
||||
A diretiva <parameter>xsl.security_prefs</parameter> foi removida.
|
||||
Em substituição, o método <methodname>XsltProcessor::setSecurityPrefs</methodname>
|
||||
deve ser chamado para controlar as preferências de segurança
|
||||
por processo base.
|
||||
</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
|
||||
-->
|
||||
102
appendices/migration70/incompatible/strings.xml
Normal file
102
appendices/migration70/incompatible/strings.xml
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: b7a780f8e762e290552b9f79d346f2bcbc272e0c Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.strings">
|
||||
<title>Mudanças na manipulação de <type>string</type>s</title>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.strings.hex">
|
||||
<title>Strings hexadecimais não são mais consideradas numéricas</title>
|
||||
|
||||
<para>
|
||||
Strings contendo números hexadecimais não são mais consideradas
|
||||
numéricas. Por exemplo:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
var_dump("0x123" == "291");
|
||||
var_dump(is_numeric("0x123"));
|
||||
var_dump("0xe" + "0x1");
|
||||
var_dump(substr("foo", "0x1"));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(true)
|
||||
bool(true)
|
||||
int(15)
|
||||
string(2) "oo"
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(false)
|
||||
bool(false)
|
||||
int(0)
|
||||
|
||||
Notice: A non well formed numeric value encountered in /tmp/test.php on line 5
|
||||
string(3) "foo"
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
<function>filter_var</function> pode ser usado se uma
|
||||
<type>string</type> contém um número hexadecimal, e também para converter uma
|
||||
string deste tipo para um <type>inteiro</type>:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$str = "0xffff";
|
||||
$int = filter_var($str, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);
|
||||
if (false === $int) {
|
||||
throw new Exception("Inteiro Inválido!");
|
||||
}
|
||||
var_dump($int); // int(65535)
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.strings.unicode-escapes">
|
||||
<title><literal>\u{</literal> pode causar erros</title>
|
||||
|
||||
<para>
|
||||
Por conta da adição da nova
|
||||
<link linkend="migration70.new-features.unicode-codepoint-escape-syntax">sintaxe de escape de códigos em Unicode</link>,
|
||||
strings contendo um <literal>\u{</literal> literal seguido de uma sequência
|
||||
inválida causará um erro fatal. Para evitar isso,
|
||||
você deve escapar a barra invertida.
|
||||
</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
|
||||
-->
|
||||
325
appendices/migration70/incompatible/variable-handling.xml
Normal file
325
appendices/migration70/incompatible/variable-handling.xml
Normal file
@@ -0,0 +1,325 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 2ef966bb53f1c34a88d1d7d8bb0c166b410678c0 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect2 xml:id="migration70.incompatible.variable-handling">
|
||||
<title>Mudanças na manipulação de variáveis</title>
|
||||
|
||||
<para>
|
||||
O PHP 7 utiliza uma sintaxe abstrata de árvore para analisar os arquivos fonte. Isso
|
||||
permitiu diversas melhorias para a linguagem que eram impossíveis
|
||||
devido a limitações no analisador utilizado em versões anteriores do
|
||||
PHP, porém resultou na remoção de alguns casos especiais por razões de consistência,
|
||||
que resulta em quebras de compatibilidades com versões anteriores. Esses casos
|
||||
são detalhados nesta seção.
|
||||
</para>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.variable-handling.indirect">
|
||||
<title>
|
||||
Mudanças na manipulação indireta de variáveis, propriedades e métodos
|
||||
</title>
|
||||
|
||||
<para>
|
||||
Acessar indiretamente variáveis, propriedades, e métodos, agora serão
|
||||
avaliados estritamente da esquerda para a direita, o oposto dos casos especiais
|
||||
em versões anteriores. A tabela a seguir mostra como a ordem de avaliação
|
||||
mudou.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<table>
|
||||
<title>Nova e antiga avaliação de expressões indiretas</title>
|
||||
<tgroup cols="3">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Expressão</entry>
|
||||
<entry>Interpretação no PHP 5</entry>
|
||||
<entry>Interpretação no PHP 7</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<code>$$foo['bar']['baz']</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>${$foo['bar']['baz']}</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>($$foo)['bar']['baz']</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<code>$foo->$bar['baz']</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>$foo->{$bar['baz']}</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>($foo->$bar)['baz']</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<code>$foo->$bar['baz']()</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>$foo->{$bar['baz']}()</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>($foo->$bar)['baz']()</code>
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<code>Foo::$bar['baz']()</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>Foo::{$bar['baz']}()</code>
|
||||
</entry>
|
||||
<entry>
|
||||
<code>(Foo::$bar)['baz']()</code>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Códigos que usam a ordem de avalição da direita para esqueda devem ser reescritos para
|
||||
o uso explícito da ordem de avaliação com chaves (veja a coluna do
|
||||
meio). Isso fará com que o código seja compatível com versões posteriores
|
||||
ao PHP 7.x e compatível com o PHP 5.x.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.variable-handling.list">
|
||||
<title>Mudanças na manipulação com a função <function>list</function></title>
|
||||
|
||||
<sect4 xml:id="migration70.incompatible.variable-handling.list.order">
|
||||
<title>
|
||||
A função <function>list</function> não faz mais atribuições em ordem reversa
|
||||
</title>
|
||||
|
||||
<para>
|
||||
A função <function>list</function> agora irá atribuir valores as variaveis na
|
||||
ordem em que foram definidas, em vez de ordem reversa. De modo geral, isso só
|
||||
afeta casos onde a função <function>list</function> é utilizada em
|
||||
conjunção com o operador de array <code>[]</code>, como mostrado a seguir:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
list($a[], $a[], $a[]) = [1, 2, 3];
|
||||
var_dump($a);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(3)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(1)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
[2]=>
|
||||
int(3)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
De modo geral, é recomendo não confiar na ordem em que as atribuições com
|
||||
que a função <function>list</function> ocorrem, como sua implementação
|
||||
detalha, isso pode mudar novamente no futuro.
|
||||
</para>
|
||||
</sect4>
|
||||
|
||||
<sect4 xml:id="migration70.incompatible.variable-handling.list.empty">
|
||||
<title>Atribuições de <function>list</function> vazias foram removidas</title>
|
||||
|
||||
<para>
|
||||
Chamadas a função <function>list</function> não podem mais ser vazias. O que é visto
|
||||
a seguir não é mais permitido:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
list() = $a;
|
||||
list(,,) = $a;
|
||||
list($x, list(), $y) = $a;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</sect4>
|
||||
|
||||
<sect4 xml:id="migration70.incompatible.variable-handling.list.string">
|
||||
<title>A função <function>list</function> não podem desempacotar <type>string</type>s</title>
|
||||
|
||||
<para>
|
||||
A função <function>list</function> não podem mais desempacotar variáveis do
|
||||
tipo <type>string</type>. Em vez disso, a função <function>str_split</function> deve ser usada.
|
||||
</para>
|
||||
</sect4>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.variable-handling.array-order">
|
||||
<title>
|
||||
A ordenação de arrays quando elementos são criados durante atribuições por
|
||||
referência mudou
|
||||
</title>
|
||||
|
||||
<para>
|
||||
A ordem dos elementos no array foi modificada quando eleste elementos,
|
||||
foram automaticamente criados por referência em uma atribuição por referência.
|
||||
Por exemplo:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$array = [];
|
||||
$array["a"] =& $array["b"];
|
||||
$array["b"] = 1;
|
||||
var_dump($array);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.5;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(2) {
|
||||
["b"]=>
|
||||
&int(1)
|
||||
["a"]=>
|
||||
&int(1)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
&example.outputs.7;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(2) {
|
||||
["a"]=>
|
||||
&int(1)
|
||||
["b"]=>
|
||||
&int(1)
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.variable-handling.global">
|
||||
<title>&global; somente aceita variáveis simples</title>
|
||||
|
||||
<para>
|
||||
<link linkend="language.variables.variable">Variáveis Variáveis</link> não
|
||||
podem mais ser utilizadas com a palavra-chave &global;. A sintaxe com chaves pode ser
|
||||
utilizada para emular o comportamente anterior, se necessário.
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function f() {
|
||||
// Válido somente no PHP 5.
|
||||
global $$foo->bar;
|
||||
|
||||
// Válido no PHP 5 e 7.
|
||||
global ${$foo->bar};
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Como princípio básico, usar qualquer coisa senão uma variável normal com a
|
||||
a palavra-chave &global; é desencorajado.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 xml:id="migration70.incompatible.variable-handling.parentheses">
|
||||
<title>
|
||||
Parênteses em torno de parâmetros de função não afetam mais seu comportamento
|
||||
</title>
|
||||
|
||||
<para>
|
||||
No PHP 5, usar parenteses redundantes em torno de parâmetros de uma função
|
||||
podem disparar avisos de quebra de padrões quando os parâmetros da função
|
||||
fossem passados por referência. Agora, o aviso sempre será emitido.
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function getArray() {
|
||||
return [1, 2, 3];
|
||||
}
|
||||
|
||||
function squareArray(array &$a) {
|
||||
foreach ($a as &$v) {
|
||||
$v **= 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Generates a warning in PHP 7.
|
||||
squareArray((getArray()));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Notice: Only variables should be passed by reference in /tmp/test.php on line 13
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</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
|
||||
-->
|
||||
136
appendices/migration70/removed-exts-sapis.xml
Normal file
136
appendices/migration70/removed-exts-sapis.xml
Normal file
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 3906d95218c8b4b1ce3fb57f81d0e7b3786794f6 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<sect1 xml:id="migration70.removed-exts-sapis" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Extensões e SAPIs removidas</title>
|
||||
|
||||
<sect2 xml:id="migration70.removed-exts-sapis.removed-exts">
|
||||
<title>Extensões removidas</title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
ereg
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
mssql
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
mysql
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
sybase_ct
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 xml:id="migration70.removed-exts-sapis.removed-sapis">
|
||||
<title>SAPIs removidas</title>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
aolserver
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
apache
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
apache_hooks
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
apache2filter
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
caudium
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
continuity
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
isapi
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
milter
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
nsapi
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
phttpd
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
pi3web
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
roxen
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
thttpd
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
tux
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
webjames
|
||||
</simpara>
|
||||
</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
|
||||
-->
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 1e17b3d07ce099720fe608c5eaaddc2625b7804c Maintainer: royopa Status: ready --><!-- CREDITS: royopa,fabioluciano -->
|
||||
<!-- EN-Revision: b7a780f8e762e290552b9f79d346f2bcbc272e0c Maintainer: royopa Status: ready --><!-- CREDITS: royopa -->
|
||||
|
||||
<phpdoc:exceptionref xml:id="class.error"
|
||||
xmlns="http://docbook.org/ns/docbook"
|
||||
@@ -8,26 +8,26 @@
|
||||
xmlns:phpdoc="http://php.net/ns/phpdoc">
|
||||
<title>Error</title>
|
||||
<titleabbrev>Error</titleabbrev>
|
||||
|
||||
|
||||
<partintro>
|
||||
|
||||
|
||||
<!-- {{{ Error intro -->
|
||||
<section xml:id="error.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
<ooclass><classname>Error</classname></ooclass> é a classe base para todas
|
||||
as exceções internas de erros do PHP.
|
||||
<ooclass><classname>Error</classname></ooclass> é a classe base para todas
|
||||
as exceções de erros PHP internos.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<section xml:id="error.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass><classname>Error</classname></ooclass>
|
||||
|
||||
|
||||
<!-- {{{ Class synopsis -->
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
@@ -41,82 +41,16 @@
|
||||
</classsynopsisinfo>
|
||||
<!-- }}} -->
|
||||
|
||||
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
|
||||
<fieldsynopsis>
|
||||
<modifier>protected</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="error.props.message">message</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>protected</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="error.props.code">code</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>protected</modifier>
|
||||
<type>string</type>
|
||||
<varname linkend="error.props.file">file</varname>
|
||||
</fieldsynopsis>
|
||||
<fieldsynopsis>
|
||||
<modifier>protected</modifier>
|
||||
<type>int</type>
|
||||
<varname linkend="error.props.line">line</varname>
|
||||
</fieldsynopsis>
|
||||
|
||||
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.error')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.error')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.throwable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
</classsynopsis>
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
</section>
|
||||
<!-- {{{ Error properties -->
|
||||
<section xml:id="error.props">
|
||||
&reftitle.properties;
|
||||
<variablelist>
|
||||
<varlistentry xml:id="error.props.message">
|
||||
<term><varname>message</varname></term>
|
||||
<listitem>
|
||||
<para>A mensagem de erro</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="error.props.code">
|
||||
<term><varname>code</varname></term>
|
||||
<listitem>
|
||||
<para>O código do erro</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="error.props.file">
|
||||
<term><varname>file</varname></term>
|
||||
<listitem>
|
||||
<para>O nome do arquivo onde o erro aconteceu</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry xml:id="error.props.line">
|
||||
<term><varname>line</varname></term>
|
||||
<listitem>
|
||||
<para>A linha onde o erro aconteceu</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
</partintro>
|
||||
|
||||
&language.predefined.error.construct;
|
||||
&language.predefined.error.getmessage;
|
||||
&language.predefined.error.getprevious;
|
||||
&language.predefined.error.getcode;
|
||||
&language.predefined.error.getfile;
|
||||
&language.predefined.error.getline;
|
||||
&language.predefined.error.gettrace;
|
||||
&language.predefined.error.gettraceasstring;
|
||||
&language.predefined.error.tostring;
|
||||
&language.predefined.error.clone;
|
||||
</phpdoc:classref>
|
||||
|
||||
</phpdoc:exceptionref>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: af4410a7e15898c3dbe83d6ea38246745ed9c6fb Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.clone" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::__clone</refname>
|
||||
<refpurpose>Clona o erro</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>private</modifier> <type>void</type><methodname>Error::__clone</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Error não pode ser clonada, então o método resulta em um erro fatal.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.void;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Erros <emphasis>não</emphasis> podem ser clonados.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 739b47be953e2edd69e3bbadb306de5b36be1a6b Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::__construct</refname>
|
||||
<refpurpose>Constrói o objeto error</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<constructorsynopsis>
|
||||
<modifier>public</modifier> <methodname>Error::__construct</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>message</parameter><initializer>""</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>code</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam choice="opt"><type>Throwable</type><parameter>previous</parameter><initializer>&null;</initializer></methodparam>
|
||||
</constructorsynopsis>
|
||||
<para>
|
||||
Constrói o Erro
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>message</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A mensagem de erro.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>code</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O código do erro.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>previous</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
O último lançável utilizado para o aninhamento de exceção.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="notes">
|
||||
&reftitle.notes;
|
||||
<note>
|
||||
<para>
|
||||
O parâmetro <parameter>message</parameter> <emphasis>NÃO</emphasis> é
|
||||
binary safe.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.getcode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getCode</refname>
|
||||
<refpurpose>Recupera o código do erro</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>mixed</type><methodname>Error::getCode</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna o código do erro.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna o código do erro como um <type>integer</type>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::getCode</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
throw new Error("Mensagem de erro", 30);
|
||||
} catch(Error $e) {
|
||||
echo "O código do erro é: " . $e->getCode();
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
O código do erro é: 30
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getCode</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.getfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getFile</refname>
|
||||
<refpurpose>Recupera o arquivo onde o erro ocorreu.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>string</type><methodname>Error::getFile</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Recupera o nome do arquivo onde o erro ocorreu.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna o nome do arquivo onde o erro ocorreu.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::getFile</function> examplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
throw new Error;
|
||||
} catch(Error $e) {
|
||||
echo $e->getFile();
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/home/bjori/tmp/ex.php
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getFile</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.getline" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getLine</refname>
|
||||
<refpurpose>Recupera a linha onde o erro ocorreu.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>int</type><methodname>Error::getLine</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Recupera o número da linha onde o erro ocorreu.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna o número da linha onde o erro ocorreu.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::getLine</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
throw new Error("Mensagem de erro");
|
||||
} catch(Error $e) {
|
||||
echo "O erro foi criado na linha: " . $e->getLine();
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
O erro foi criado na linha: 3
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getLine</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.getmessage" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getMessage</refname>
|
||||
<refpurpose>Recupera a mensagem de erro</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>string</type><methodname>Error::getMessage</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Recupera a mensagem de erro.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Recupera a mensagem de erro como uma string.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::getMessage</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
throw new Error("Mensagem de erro");
|
||||
} catch(Error $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Mensagem de erro
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getMessage</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.getprevious" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getPrevious</refname>
|
||||
<refpurpose>Retorna o último Throwable</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>Throwable</type><methodname>Error::getPrevious</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna o último Throwable (o terceiro parâmetro do <methodname>Error::__construct</methodname>).
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Retorna o último <classname>Throwable</classname> se disponível
|
||||
ou &null;.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><methodname>Error::getPrevious</methodname> exemplo</title>
|
||||
<para>
|
||||
Iterando e imprimindo a pilha de erro.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class MyCustomError extends Error {}
|
||||
|
||||
function doStuff() {
|
||||
try {
|
||||
throw new InvalidArgumentError("You are doing it wrong!", 112);
|
||||
} catch(Error $e) {
|
||||
throw new MyCustomError("Something happened", 911, $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
doStuff();
|
||||
} catch(Error $e) {
|
||||
do {
|
||||
printf("%s:%d %s (%d) [%s]\n", $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode(), get_class($e));
|
||||
} while($e = $e->getPrevious());
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/home/bjori/ex.php:8 Something happened (911) [MyCustomError]
|
||||
/home/bjori/ex.php:6 You are doing it wrong! (112) [InvalidArgumentError]
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getPrevious</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.gettrace" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getTrace</refname>
|
||||
<refpurpose>Recupera a pilha de rastreio</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>array</type><methodname>Error::getTrace</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Recupera a pilha de rastreio.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Recupera a pilha de rastreio como um <type>array</type>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::getTrace</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function test() {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
try {
|
||||
test();
|
||||
} catch(Error $e) {
|
||||
var_dump($e->getTrace());
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(4) {
|
||||
["file"]=>
|
||||
string(22) "/home/bjori/tmp/ex.php"
|
||||
["line"]=>
|
||||
int(7)
|
||||
["function"]=>
|
||||
string(4) "test"
|
||||
["args"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getTrace</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.gettraceasstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::getTraceAsString</refname>
|
||||
<refpurpose>Recupera a pilha de rastreio como uma string</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>string</type><methodname>Error::getTraceAsString</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Recupera a pilha de rastreio como uma string.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Recupera a pilha de rastreio como uma string.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::getTraceAsString</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function test() {
|
||||
throw new Error;
|
||||
}
|
||||
|
||||
try {
|
||||
test();
|
||||
} catch(Error $e) {
|
||||
echo $e->getTraceAsString();
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
#0 /home/bjori/tmp/ex.php(7): test()
|
||||
#1 {main}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::getTraceAsString</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 4eefb1e936f416333e05635b0ca2ac10166fdcec Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
|
||||
<refentry xml:id="error.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Error::__toString</refname>
|
||||
<refpurpose>Representação em string do erro</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>string</type> <methodname>Error::__toString</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Retorna a representação em <type>string</type> do erro.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
&no.function.parameters;
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Iterando e imprimindo a trilha de erro.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>Error::__toString</function> exemplo</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
throw new Error("Mensagem de erro");
|
||||
} catch(Error $e) {
|
||||
echo $e;
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs.similar;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Error: Mensagem de erro in /home/bjori/tmp/ex.php:3
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><methodname>Throwable::__toString</methodname></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- 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
|
||||
-->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 9fedcb9b200af0feedab643469bd39f397e3108f Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
|
||||
<!-- EN-Revision: b7a780f8e762e290552b9f79d346f2bcbc272e0c Maintainer: royopa Status: ready --><!-- CREDITS: royopa -->
|
||||
|
||||
<phpdoc:exceptionref xml:id="class.typeerror"
|
||||
xmlns="http://docbook.org/ns/docbook"
|
||||
@@ -8,31 +8,27 @@
|
||||
xmlns:phpdoc="http://php.net/ns/phpdoc">
|
||||
<title>TypeError</title>
|
||||
<titleabbrev>TypeError</titleabbrev>
|
||||
|
||||
|
||||
<partintro>
|
||||
|
||||
|
||||
<!-- {{{ Error intro -->
|
||||
<section xml:id="typeerror.intro">
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
Existem três cenários en que um
|
||||
<ooclass><classname>TypeError</classname></ooclass> pode ser lançado. O
|
||||
primeiro é quando o tipo do argumento passado a uma função não combina
|
||||
com o tipo do parâmetro declarado. O segundo é quando o valor
|
||||
retornado de uma função não combina com o tipo de retorno
|
||||
declarado. O terceiro é quando um número de argumentos inválidos são passados a uma função
|
||||
built-in do PHP (somente no strict mode).
|
||||
</para>
|
||||
<ooclass><classname>TypeError</classname></ooclass> é lançado quando um
|
||||
tipo estrito está habilitado e um argumento inválido é inserido em uma
|
||||
função.
|
||||
</para>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
<section xml:id="typeerror.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass><classname>TypeError</classname></ooclass>
|
||||
|
||||
|
||||
<!-- {{{ Class synopsis -->
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
@@ -49,13 +45,13 @@
|
||||
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
|
||||
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.throwable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
</classsynopsis>
|
||||
|
||||
|
||||
<!-- }}} -->
|
||||
|
||||
|
||||
</section>
|
||||
</partintro>
|
||||
</phpdoc:exceptionref>
|
||||
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
|
||||
Reference in New Issue
Block a user