Files
doc-fr/reference/errorfunc/functions/error-reporting.xml
Yannick Torres 404455225a sync with EN
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@270268 c90b9560-bf6c-de11-be94-00142212c4b1
2008-12-01 22:09:21 +00:00

289 lines
8.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.34 $ -->
<!-- EN-Revision: 1.23 Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.error-reporting" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>error_reporting</refname>
<refpurpose>Fixe le niveau de rapport d'erreurs PHP</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>error_reporting</methodname>
<methodparam choice="opt"><type>int</type><parameter>level</parameter></methodparam>
</methodsynopsis>
<para>
<function>error_reporting</function> modifie la directive
<link linkend="ini.error-reporting">error_reporting</link>
pendant l'exécution du script. PHP possède plusieurs niveaux d'erreurs,
utiliser cette fonction configure ce niveau pendant la durée (d'exécution)
de votre script.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>level</parameter></term>
<listitem>
<para>
Le nouveau niveau <link linkend="ini.error-reporting">error_reporting</link>.
Il peut être un champ de bits ou une combinaison de constantes.
L'utilisation des constantes est vivement recommandée pour assurer une
compatibilité maximale avec les futures versions.
Au fur et à mesure que de nouveaux niveaux d'erreurs sont créés, les valeurs
évoluent, c'est pourquoi les anciennes valeurs n'ont plus forcément la même
signification.
</para>
<para>
Les constantes représentant les niveaux d'erreurs disponibles sont listées
ci-dessous. La signification actuelle de ces niveaux d'erreurs est décrite
dans le manuel sur les
<link linkend="errorfunc.constants">constantes prédéfinies</link>.
<table>
<title>Constantes des niveaux d'<function>error_reporting</function> et la valeur de bits</title>
<tgroup cols="2">
<thead>
<row>
<entry>valeur</entry>
<entry>constante</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-error">E_ERROR</link>
</entry>
</row>
<row>
<entry>2</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-warning">E_WARNING</link>
</entry>
</row>
<row>
<entry>4</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-parse">E_PARSE</link>
</entry>
</row>
<row>
<entry>8</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-notice">E_NOTICE</link>
</entry>
</row>
<row>
<entry>16</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-core-error">E_CORE_ERROR</link>
</entry>
</row>
<row>
<entry>32</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-core-warning">E_CORE_WARNING</link>
</entry>
</row>
<row>
<entry>64</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-compile-error">E_COMPILE_ERROR</link>
</entry>
</row>
<row>
<entry>128</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-compile-warning">E_COMPILE_WARNING</link>
</entry>
</row>
<row>
<entry>256</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-user-error">E_USER_ERROR</link>
</entry>
</row>
<row>
<entry>512</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-user-warning">E_USER_WARNING</link>
</entry>
</row>
<row>
<entry>1024</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-user-error">E_USER_NOTICE</link>
</entry>
</row>
<row>
<entry>6143</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-all">E_ALL</link>
</entry>
</row>
<row>
<entry>2048</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-strict">E_STRICT</link>
</entry>
</row>
<row>
<entry>4096</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-recoverable-error">E_RECOVERABLE_ERROR</link>
</entry>
</row>
<row>
<entry>8192</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-deprecated-error">E_DEPRECATED</link>
</entry>
</row>
<row>
<entry>16384</entry>
<entry>
<link linkend="errorfunc.constants.errorlevels.e-user-deprecated">E_USER_DEPRECATED</link>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retourne l'ancien niveau d'<link linkend="ini.error-reporting">error_reporting</link>.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.0.0</entry>
<entry><constant>E_STRICT</constant> est introduit (ne fait plus partie de <constant>E_ALL</constant>).</entry>
</row>
<row>
<entry>5.2.0</entry>
<entry><constant>E_RECOVERABLE_ERROR</constant> est introduit.</entry>
</row>
<row>
<entry>5.3.0</entry>
<entry><constant>E_DEPRECATED</constant> et <constant>E_USER_DEPRECATED</constant>
ont été introduits.</entry>
</row>
<row>
<entry>6</entry>
<entry><constant>E_STRICT</constant> devient une partie de <constant>E_ALL</constant>.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec <function>error_reporting</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Désactiver le rapport d'erreurs
error_reporting(0);
// Rapporte les erreurs d'exécution de script
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Rapporter les E_NOTICE peut vous aider à améliorer vos scripts
// (variables non initialisées, variables mal orthographiées..)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// Rapporte toutes les erreurs à part les E_NOTICE
// C'est la configuration par défaut de php.ini
error_reporting(E_ALL ^ E_NOTICE);
// Reporte toutes les erreurs PHP
error_reporting(E_ALL);
// Même chose que error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<warning>
<simpara>
La plupart des erreurs <constant>E_STRICT</constant> sont
évaluées au moment de la compilation, comme les erreurs
qui ne sont pas reportées dans le fichier lorsque
<link linkend="ini.error-reporting">error_reporting</link>
est défini pour inclure les erreurs <constant>E_STRICT</constant>
(et vice-versa).
</simpara>
</warning>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>La directive <link linkend="ini.display-errors">display_errors</link></member>
<member>La directive <link linkend="ini.html-errors">html_errors</link></member>
<member>La directive <link linkend="ini.xmlrpc-errors">xmlrpc_errors</link></member>
<member><function>ini_set</function></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:"../../../../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
-->