Files
doc-fr/reference/errorfunc/functions/error-reporting.xml
Mehdi Achour ab15e99d6b sync with en
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@151599 c90b9560-bf6c-de11-be94-00142212c4b1
2004-02-17 10:58:10 +00:00

195 lines
5.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- splitted from ./fr/functions/errorfunc.xml, last change in rev 1.2 -->
<!-- last change to 'error-reporting' in en/ tree in rev 1.1 -->
<refentry id="function.error-reporting">
<refnamediv>
<refname>error_reporting</refname>
<refpurpose>Fixe le niveau de rapport d'erreurs PHP</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<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>
<para>
<function>error_reporting</function> fixe le niveau de rapport d'erreurs PHP
et retourne l'ancienne valeur. Le paramètre <parameter>level</parameter> 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>
<example>
<title>Exemples d'utilisation de <function>error_reporting</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Désactiver le rapport d'erreurs
error_reporting(0);
// Rapporter 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);
// Rapporter toutes les erreurs à part les E_NOTICE
// C'est la configuration par défaut de php.ini
error_reporting(E_ALL ^ E_NOTICE);
// Repporter toutes les erreurs PHP (pour PHP 3, utilisez l'entier 63)
error_reporting(E_ALL);
// Même chose que error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
?>
]]>
</programlisting>
</example>
</para>
<para>
Les constantes disponibles sont listés içi. Leur signification est
décrite dans la section <link
linkend="errorfunc.constants">constantes prédéfinies</link>.
<table>
<title>Constantes avec <function>error_reporting</function></title>
<tgroup cols="2">
<thead>
<row>
<entry>constante</entry>
<entry>valeur</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>
<link linkend="e-error">E_ERROR</link>
</entry>
</row>
<row>
<entry>2</entry>
<entry>
<link linkend="e-warning">E_WARNING</link>
</entry>
</row>
<row>
<entry>4</entry>
<entry>
<link linkend="e-parse">E_PARSE</link>
</entry>
</row>
<row>
<entry>8</entry>
<entry>
<link linkend="e-notice">E_NOTICE</link>
</entry>
</row>
<row>
<entry>16</entry>
<entry>
<link linkend="e-core-error">E_CORE_ERROR</link>
</entry>
</row>
<row>
<entry>32</entry>
<entry>
<link linkend="e-core-warning">E_CORE_WARNING</link>
</entry>
</row>
<row>
<entry>64</entry>
<entry>
<link linkend="e-compile-error">E_COMPILE_ERROR</link>
</entry>
</row>
<row>
<entry>128</entry>
<entry>
<link linkend="e-compile-warning">E_COMPILE_WARNING</link>
</entry>
</row>
<row>
<entry>256</entry>
<entry>
<link linkend="e-user-error">E_USER_ERROR</link>
</entry>
</row>
<row>
<entry>512</entry>
<entry>
<link linkend="e-user-warning">E_USER_WARNING</link>
</entry>
</row>
<row>
<entry>1024</entry>
<entry>
<link linkend="e-user-error">E_USER_NOTICE</link>
</entry>
</row>
<row>
<entry>2048</entry>
<entry>
<link linkend="e-strict">E_STRICT</link>
</entry>
</row>
<row>
<entry>4096</entry>
<entry>
<link linkend="e-all">E_ALL</link>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<warning>
<simpara>
A partir de PHP 5.0.0, la constante <constant>E_STRICT</constant> avec comme valeur
2048 est introduite. La valeur de <constant>E_ALL</constant> est donc
passé à 4096.
</simpara>
</warning>
<para>
Voir aussi
la directive <link linkend="ini.display-errors">display_errors</link>
et <function>ini_set</function>.
</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
-->