1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-25 07:32:13 +01:00
Files
archived-doc-ja/reference/errorfunc/functions/error-reporting.xml
TAKAGI Masahiro 7a7055fa0e sync with en.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@315454 c90b9560-bf6c-de11-be94-00142212c4b1
2011-08-24 20:55:18 +00:00

188 lines
6.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a0c58ee4211664e7baa2e3cde0ed023bbef2d98d Maintainer: hirokawa Status: ready -->
<!-- CREDITS: takagi -->
<refentry xml:id="function.error-reporting" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>error_reporting</refname>
<refpurpose>出力する 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> 関数は、
<link linkend="ini.error-reporting">error_reporting</link> ディレクティブを
実行時に設定します。PHP には多くのエラーレベルがあり、
この関数によりスクリプトの持続時間(実行時間)のレベルが設定されます。
オプションの <parameter>level</parameter> を指定しなかった場合は、
<function>error_reporting</function> は単に現在のエラーレベルを返します。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>level</parameter></term>
<listitem>
<para>
新しい <link linkend="ini.error-reporting">error_reporting</link>
レベル。ビットマスクまたは名前つき定数のどちらかです。将来の
バージョンとの互換性を保証するために、名前つき定数の使用が
強く推奨されています。エラーレベルが追加されると、整数の幅は増加します。
そのため、以前の整数を使用するエラーレベルは常に期待通りに動作するとは
限りません。
</para>
<para>
利用可能なエラーレベル定数とその実際の意味は、
<link linkend="errorfunc.constants">定義済みの定数</link>
記述されています。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
変更前の <link linkend="ini.error-reporting">error_reporting</link>
レベルを返します。<parameter>level</parameter>
パラメータを指定しなかった場合は、現在のレベルを返します。
</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.4.0</entry>
<entry><constant>E_STRICT</constant><constant>E_ALL</constant> に含まれるようになりました。</entry>
</row>
<row>
<entry>5.3.0</entry>
<entry><constant>E_DEPRECATED</constant><constant>E_USER_DEPRECATED</constant> が追加されました。</entry>
</row>
<row>
<entry>5.2.0</entry>
<entry><constant>E_RECOVERABLE_ERROR</constant> が追加されました。</entry>
</row>
<row>
<entry>5.0.0</entry>
<entry><constant>E_STRICT</constant> が追加されました (これは <constant>E_ALL</constant> には含まれません)。</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>error_reporting</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
// 全てのエラー出力をオフにする
error_reporting(0);
// 単純な実行時エラーを表示する
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// E_NOTICE を表示させるのもおすすめ(初期化されていない
// 変数、変数名のスペルミスなど…)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
// E_NOTICE 以外の全てのエラーを表示する
// これは php.ini で設定されているデフォルト値
error_reporting(E_ALL ^ E_NOTICE);
// 全ての PHP エラーを表示する (Changelog を参照ください)
error_reporting(E_ALL);
// 全ての PHP エラーを表示する
error_reporting(-1);
// error_reporting(E_ALL); と同じ
ini_set('error_reporting', E_ALL);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<warning>
<simpara>
ほとんどの <constant>E_STRICT</constant> レベルのエラーは
スクリプトのコンパイル時に発生します。そのため、
<link linkend="ini.error-reporting">error_reporting</link>
<constant>E_STRICT</constant> を含むように設定されている環境では
これらのエラーを検出できません (逆も同様です)。
</simpara>
</warning>
<tip>
<simpara>
値に <literal>-1</literal> を指定すると、仮に将来のバージョンの PHP
で新しいレベルと定数が追加されたとしてもすべてのエラーを表示するようになります。
<constant>E_ALL</constant> 定数も、PHP 5.4 以降これと同じ挙動になります。
</simpara>
</tip>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="ini.display-errors">display_errors</link> ディレクティブ</member>
<member><link linkend="ini.html-errors">html_errors</link> ディレクティブ</member>
<member><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:"~/.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
-->