cvs: phpdoc-ja /reference/errorfunc ini.xml /reference/errorfunc/functions debug-backtrace.xml error-log.xml error-reporting.xml
restore-error-handler.xml set-error-handler.xml set-exception-handler.xml trigger-error.xml user-error.xml

From: Date: Sat, 13 Aug 2005 23:57:47 +0000
Subject: cvs: phpdoc-ja /reference/errorfunc ini.xml /reference/errorfunc/functions debug-backtrace.xml error-log.xml error-reporting.xml
restore-error-handler.xml set-error-handler.xml set-exception-handler.xml trigger-error.xml user-error.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-1122@lists.php.net to get a copy of this message
takagi Sat Aug 13 19:57:47 2005 EDT Modified files: /phpdoc-ja/reference/errorfunc/functions user-error.xml trigger-error.xml set-exception-handler.xml set-error-handler.xml restore-error-handler.xml error-reporting.xml error-log.xml debug-backtrace.xml /phpdoc-ja/reference/errorfunc ini.xml Log: sync with en.

http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/user-error.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/errorfunc/functions/user-error.xml diff -u phpdoc-ja/reference/errorfunc/functions/user-error.xml:1.4 phpdoc-ja/reference/errorfunc/functions/user-error.xml:1.5 --- phpdoc-ja/reference/errorfunc/functions/user-error.xml:1.4 Sun Jan 2 02:23:31 2005 +++ phpdoc-ja/reference/errorfunc/functions/user-error.xml Sat Aug 13 19:57:46 2005 @@ -1,33 +1,22 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./ja/functions/errorfunc.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> - <refentry id="function.user-error"> - <refnamediv> - <refname>user_error</refname> - <refpurpose> - ユーザレベルのエラー/警告/通知メッセージを発生する - </refpurpose> - </refnamediv> - <refsect1> - <title>説明</title> - <methodsynopsis> - <type>void</type><methodname>user_error</methodname> - <methodparam><type>string</type><parameter>error_msg</parameter></methodparam> - <methodparam><type>int</type><parameter> - <replaceable><optional>error_type</optional></replaceable> - </parameter></methodparam> - </methodsynopsis> - <para> - これは、<function>trigger_error</function>へのエイリアスです。 - </para> - <para> - <function>error_reporting</function>, - <function>set_error_handler</function>, - <function>restore_error_handler</function>, - <function>trigger_error</function>も参照ください。 - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.6 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> +<refentry id="function.user-error"> + <refnamediv> + <refname>user_error</refname> + <refpurpose><function>trigger_error</function> のエイリアス</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <para> + &info.function.alias; + <function>trigger_error</function>. + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/trigger-error.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/errorfunc/functions/trigger-error.xml diff -u phpdoc-ja/reference/errorfunc/functions/trigger-error.xml:1.4 phpdoc-ja/reference/errorfunc/functions/trigger-error.xml:1.5 --- phpdoc-ja/reference/errorfunc/functions/trigger-error.xml:1.4 Sun Jan 2 02:23:31 2005 +++ phpdoc-ja/reference/errorfunc/functions/trigger-error.xml Sat Aug 13 19:57:46 2005 @@ -1,55 +1,100 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./ja/functions/errorfunc.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> - <refentry id="function.trigger-error"> - <refnamediv> - <refname>trigger_error</refname> - <refpurpose> - ユーザレベルのエラー/警告/通知メッセージを生成する - </refpurpose> - </refnamediv> - <refsect1> - <title>説明</title> - <methodsynopsis> - <type>void</type><methodname>trigger_error</methodname> - <methodparam><type>string</type><parameter>error_msg</parameter></methodparam> - <methodparam><type>int</type><parameter> - <replaceable><optional>error_type</optional></replaceable> - </parameter></methodparam> - </methodsynopsis> +<!-- EN-Revision: 1.12 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> +<refentry id="function.trigger-error"> + <refnamediv> + <refname>trigger_error</refname> + <refpurpose>ユーザレベルのエラー/警告/通知メッセージを生成する</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>bool</type><methodname>trigger_error</methodname> + <methodparam><type>string</type><parameter>error_msg</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>error_type</parameter></methodparam> + </methodsynopsis> + <para> + ユーザエラーを発生するために使用され、組込のエラーハンドラまたは + 新しいエラーハンドラ(<function>set_error_handler</function>) + として設定済のユーザ定義関数と組み合わせて使用されます。 + </para> + <para> + この関数は、実行時の例外に特定の応答を生成する必要がある場合に + 便利です。 + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>error_msg</parameter></term> + <listitem> + <para> + このエラーに割り当てられたメッセージ。長さは最大 1024 文字までです。 + 1024 文字を超える部分は切り捨てられます。 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>error_type</parameter></term> + <listitem> + <para> + このエラーに割り当てられたエラー型。E_USER 関連の定数のみが指定可能で、 + デフォルトは <constant>E_USER_NOTICE</constant> です。 + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + この関数は、間違った <parameter>error_type</parameter> が指定された場合に + &false; を、それ以外の場合に &true; を返します。 + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>trigger_error</function> の例</title> <para> - ユーザエラーを発生するために使用され、組込のエラーハンドラまたは - 新しいエラーハンドラ(<function>set_error_handler</function>)とし - て設定済のユーザ定義関数と組み合わせて使用されます。エラー型には - E_USER 関連の定数のみが使用可能で、デフォルトは - <constant>E_USER_NOTICE</constant>となっています。 + より拡張した例については <function>set_error_handler</function> + を参照ください。 </para> - <para> - この関数は、実行時の例外に特定の応答を生成する必要がある場合に有 - 用です。以下に例を示します。 - <informalexample> - <programlisting> + <programlisting role="php"> <![CDATA[ -if (assert ($divisor == 0)) - trigger_error ("Cannot divide by zero", E_USER_ERROR); +<?php +if (assert($divisor == 0)) { + trigger_error("Cannot divide by zero", E_USER_ERROR); +} +?> ]]> - </programlisting> - </informalexample> - <note> - <para> - より、詳細な例については、 - <function>set_error_handler</function> を参照ください。 - </para> - </note> - </para> - <para> - <function>error_reporting</function>, - <function>set_error_handler</function>, - <function>restore_error_handler</function>, - <function>user_error</function>も参照ください。 - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>error_reporting</function></member> + <member><function>set_error_handler</function></member> + <member><function>restore_error_handler</function></member> + <member>The <link linkend="errorfunc.constants">エラーレベル定数</link></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/set-exception-handler.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc-ja/reference/errorfunc/functions/set-exception-handler.xml diff -u phpdoc-ja/reference/errorfunc/functions/set-exception-handler.xml:1.1 phpdoc-ja/reference/errorfunc/functions/set-exception-handler.xml:1.2 --- phpdoc-ja/reference/errorfunc/functions/set-exception-handler.xml:1.1 Thu Dec 30 08:04:09 2004 +++ phpdoc-ja/reference/errorfunc/functions/set-exception-handler.xml Sat Aug 13 19:57:46 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.1 $ --> -<!-- EN-Revision: 1.4 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.2 $ --> +<!-- EN-Revision: 1.7 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.set-exception-handler"> <refnamediv> <refname>set_exception_handler</refname> @@ -15,31 +16,17 @@ <methodparam><type>callback</type><parameter>exception_handler</parameter></methodparam> </methodsynopsis> <para> - 例外がtry/catchブロックの中でキャッチされなかった場合の + 例外が try/catch ブロックの中でキャッチされなかった場合の デフォルトの例外ハンドラを設定します。 例外は、<parameter>exception_handler</parameter> がコールされた後に 停止します。 </para> <para> <parameter>exception_handler</parameter> は、 - <function>set_exception_handler</function>をコールする前に - 定義する必要があります。この関数は、パラメータを一つ + <function>set_exception_handler</function> をコールする前に + 定義する必要があります。このハンドラ関数は、パラメータをひとつ とる必要があります。 このパラメータは、スローされた例外オブジェクトとなります。 - <methodsynopsis> - <methodname><replaceable>exception_handler</replaceable></methodname> - <methodparam><type>object</type><parameter>exception</parameter></methodparam> - </methodsynopsis> - <variablelist> - <varlistentry> - <term><parameter>exception</parameter></term> - <listitem> - <para> - キャッチされない例外が発生した際にコールされる関数の名前 - </para> - </listitem> - </varlistentry> - </variablelist> </para> </refsect1> <refsect1> @@ -60,7 +47,7 @@ <refsect1> &reftitle.returnvalues; <para> - 前に定義された例外ハンドラまたはエラー発生時に&false;を返します。 + 前に定義された例外ハンドラの名前、またはエラー発生時に &false; を返します。 前にハンドラが定義されていない場合、空の文字列が返されます。 </para> </refsect1> @@ -89,10 +76,11 @@ <refsect1> &reftitle.seealso; <para> - <function>restore_exception_handler</function> - <function>restore_error_handler</function> - <function>error_reporting</function>&listendand; - <link linkend="language.oop5.exceptions">PHP 5例外</link> + <function>restore_exception_handler</function>, + <function>restore_error_handler</function>, + <function>error_reporting</function>, + &seealso.callback;, &listendand; + <link linkend="language.exceptions">PHP 5 例外</link>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/set-error-handler.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-ja/reference/errorfunc/functions/set-error-handler.xml diff -u phpdoc-ja/reference/errorfunc/functions/set-error-handler.xml:1.6 phpdoc-ja/reference/errorfunc/functions/set-error-handler.xml:1.7 --- phpdoc-ja/reference/errorfunc/functions/set-error-handler.xml:1.6 Sun Jan 2 02:23:31 2005 +++ phpdoc-ja/reference/errorfunc/functions/set-error-handler.xml Sat Aug 13 19:57:46 2005 @@ -1,14 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.6 $ --> -<!-- EN-Revision: 1.24 Maintainer: hirokawa Status: ready --> - <refentry id="function.set-error-handler"> +<!-- $Revision: 1.7 $ --> +<!-- EN-Revision: 1.30 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> +<refentry id="function.set-error-handler"> <refnamediv> <refname>set_error_handler</refname> <refpurpose> ユーザ定義のエラーハンドラ関数を設定する </refpurpose> </refnamediv> - <refsect1> + + <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>mixed</type><methodname>set_error_handler</methodname> @@ -18,198 +20,278 @@ <para> スクリプトのエラー処理を行うユーザ関数 (<parameter>error_handler</parameter>)を設定します。 - 前に定義されたエラーハンドラ(ある場合)を含む文字列または - エラーの場合に &false; を返します。 - 前に定義されたハンドラがクラスメソッドの場合、この関数は、 - クラスとメソッド名からなる添字配列を返します。 </para> <para> この関数は、実行時のエラー処理をユーザが定義するために使用します。 - 例えば、致命的なエラーを発生した場合や、ある条件のもとに - (<function>trigger_error</function>を使用して)エラーを発生する必 - 要がある場合にデータやファイルを消去する必要があるようなアプリケー - ションがこの場合にあたります。 - </para> - <para> - 二番目のパラメータ<parameter>error_types</parameter>は、PHP 5で導入され、 - 設定パラメータ - <link linkend="ini.error-reporting">error_reporting</link>と - 全く同様に、表示するエラーを制御するために - <parameter>error_handler</parameter>起動をマスクする際に - 使用可能です。 - このマスクを指定しない場合、 - <parameter>error_handler</parameter>は - <link - linkend="ini.error-reporting">error_reporting</link>の設定によらず - 全てのエラーに関してコールされます。 - </para> - <para> - ユーザ関数は、二つの引数、エラーコードとエラーを記述する文字列を受け取る - 必要があります。PHP 4.0.2 からオプションのパラメータとして3つの引数が - 追加されています。これらは、エラーが発生したファイル名、エラーが発生した行、 - 発生したエラーのコンテキスト(エラーが発生した場所でのアクティブなシンボルテーブ - ルを指す配列)です。 - 関数は、以下のように表されます。 - <methodsynopsis> - <methodname><replaceable>handler</replaceable></methodname> - <methodparam><type>int</type><parameter>errno</parameter></methodparam> - <methodparam><type>string</type><parameter>errstr</parameter></methodparam> - <methodparam choice="opt"><type>string</type><parameter>errfile</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>errline</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>errcontext</parameter></methodparam> - </methodsynopsis> + 例えば、致命的なエラーの際にデータやファイルを消去する必要があるような + アプリケーションや、ある条件のもとに + (<function>trigger_error</function>を使用して)エラーを発生する必要がある + アプリケーションがこの場合にあたります。 + </para> + <para> + PHP の標準のエラーハンドラは完全にバイパスされることに注意してください。 + <function>error_reporting</function> の設定にかかわらず、どのような場合でも + ユーザが設定したエラーハンドラがコールされます。ただし、この場合でも + ハンドラで <function>error_reporting</function> のカレントの値を読み、 + それにあわせて適切に動作させることは可能です。エラーを発生した命令の前に + <link linkend="language.operators.errorcontrol">@ エラー制御演算子 + </link> が付加されている場合、この値は 0 となることには注意しましょう。 + </para> + <para> + ユーザハンドラ関数は、必要に応じて <function>die</function> を + コールする責任があることにも注意しましょう。エラーハンドラ関数が + リターンした場合、スクリプトの実行は、エラーを発生した命令の次の命令に + 継続されます。 + </para> + <para> + 以下のエラータイプは、ユーザ定義の関数では扱えません。 + <constant>E_ERROR</constant>, <constant>E_PARSE</constant>, + <constant>E_CORE_ERROR</constant>, <constant>E_CORE_WARNING</constant>, + <constant>E_COMPILE_ERROR</constant>, + <constant>E_COMPILE_WARNING</constant> および + <function>set_error_handler</function> がコールされたファイルで発生した + 大半の <constant>E_STRICT</constant> 。 + </para> + <para> + (ファイルアップロードのように)スクリプトが実行される前にエラーが + 発生した場合、カスタムエラーハンドラはコールされません。 + これは、その時点では登録されていないためです。 + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> <variablelist> <varlistentry> - <term><parameter>errno</parameter></term> - <listitem> - <simpara> - The first parameter, <replaceable>errno</replaceable>, contains the - level of the error raised, as an integer. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><parameter>errstr</parameter></term> - <listitem> - <simpara> - The second parameter, <parameter>errstr</parameter>, contains the - error message, as a string. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><parameter>errfile</parameter></term> - <listitem> - <simpara> - The third parameter is optional, <parameter>errfile</parameter>, - which contains the filename that the error was raised in, as a string. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><parameter>errline</parameter></term> + <term><parameter>error_handler</parameter></term> <listitem> - <simpara> - The fourth parameter is optional, <parameter>errline</parameter>, - which contains the line number the error was raised at, as an integer. - </simpara> + <para> + ユーザ関数は、エラーコードとエラーを記述する文字列の 2 つの引数を + 受け取る必要があります。さらにオプションのパラメータとして 3 つの引数が + 追加されています。これらは、エラーが発生したファイル名、エラーが + 発生した行、発生したエラーのコンテキスト(エラーが発生した場所での + アクティブなシンボルテーブルを指す配列)です。関数は以下のようになります。 + </para> + <para> + <methodsynopsis> + <methodname><replaceable>handler</replaceable></methodname> + <methodparam><type>int</type><parameter>errno</parameter></methodparam> + <methodparam><type>string</type><parameter>errstr</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>errfile</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>errline</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>errcontext</parameter></methodparam> + </methodsynopsis> + <variablelist> + <varlistentry> + <term><parameter>errno</parameter></term> + <listitem> + <simpara> + 最初のパラメータ <parameter>errno</parameter> は、発生させる + エラーのレベルを整数で格納します。 + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>errstr</parameter></term> + <listitem> + <simpara> + 2 番目のパラメータ <parameter>errstr</parameter> は、 + エラーメッセージを文字列で格納します。 + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>errfile</parameter></term> + <listitem> + <simpara> + 3 番目のパラメータ <parameter>errfile</parameter> はオプションで、 + エラーが発生したファイルの名前を文字列で格納します。 + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>errline</parameter></term> + <listitem> + <simpara> + 4 番目のパラメータ <parameter>errline</parameter> はオプションで、 + エラーが発生した行番号を整数で格納します。 + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>errcontext</parameter></term> + <listitem> + <simpara> + 5 番目のパラメータ <parameter>errcontext</parameter> はオプションで、 + エラーが発生した場所のアクティブシンボルテーブルを指す配列です。 + つまり、エラーが発生したスコープ内でのすべての変数の内容を格納した + 配列が <parameter>errcontext</parameter> だということです。 + </simpara> + </listitem> + </varlistentry> + </variablelist> + </para> </listitem> </varlistentry> <varlistentry> - <term><parameter>errcontext</parameter></term> + <term><parameter>error_types</parameter></term> <listitem> - <simpara> - The fifth parameter is optional, <parameter>errcontext</parameter>, - which is an array that points to the active symbol table at the point - the error occurred. In other words, <parameter>errcontext</parameter> - will contain an array of every variable that existed in the scope the - error was triggered in. - </simpara> + <para> + 設定パラメータ + <link linkend="ini.error-reporting">error_reporting</link> + で表示するエラーを制御するのと全く同様に、 + <parameter>error_handler</parameter> の起動を制御する際に + 使用可能です。 + このマスクを指定しない場合、 + <parameter>error_handler</parameter> は + <link + linkend="ini.error-reporting">error_reporting</link> の設定によらず + 全てのエラーに関してコールされます。 + </para> </listitem> </varlistentry> - </variablelist> + </variablelist> </para> - <note> - <simpara> - 関数名の代わりにオブジェクトへのリファレンスとメソッド名を含む配列 - を指定することもできます。(PHP 4.3.0以降) - </simpara> - </note> - <note> - <para> - 以下のエラー型はユーザ定義関数では扱うことができません。 - <constant>E_ERROR</constant>, <constant>E_PARSE</constant>, - <constant>E_CORE_ERROR</constant>, <constant>E_CORE_WARNING</constant>, - <constant>E_COMPILE_ERROR</constant>, - <constant>E_COMPILE_WARNING</constant> - </para> - </note> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + 前に定義されたエラーハンドラ(ある場合)を含む文字列、または + エラーの場合には &false; を返します。 + 前に定義されたハンドラがクラスメソッドの場合、この関数は、 + クラスとメソッド名からなる添字配列を返します。 + </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> + <parameter>error_types</parameter> パラメータが追加されました。 + </entry> + </row> + <row> + <entry>4.3.0</entry> + <entry> + <parameter>error_handler</parameter> として、関数名のかわりに + オブジェクトへのリファレンスとメソッド名を含む配列を指定することも + できます。 + </entry> + </row> + <row> + <entry>4.0.2</entry> + <entry> + ユーザ定義関数 <parameter>error_handler</parameter> で 3 つの + オプションパラメータが利用できるようになりました。filename, line number, + および context です。 + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> - 以下の例では、エラーを発生することにより内部例外の処理を表示し、 - ユーザ定義関数によりこれを処理します。 <example> <title> - <function>set_error_handler</function>および - <function>trigger_error</function>によるエラー処理 + <function>set_error_handler</function> および + <function>trigger_error</function> によるエラー処理 </title> + <para> + 以下の例では、エラーを発生させることによる内部例外の処理や + それらをユーザ定義関数で処理する方法を説明します。 + </para> <programlisting role="php"> <![CDATA[ <?php - -// ユーザエラー定数による再定義 - PHP4 のみ -define("FATAL",E_USER_ERROR); -define("ERROR",E_USER_WARNING); -define("WARNING",E_USER_NOTICE); - // このスクリプトのエラー出力レベルを設定 -error_reporting (FATAL | ERROR | WARNING); +error_reporting(E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE); // エラーハンドラ関数 -function myErrorHandler ($errno, $errstr, $errfile, $errline) { +function myErrorHandler($errno, $errstr, $errfile, $errline) +{ switch ($errno) { - case FATAL: - echo "<b>FATAL</b> [$errno] $errstr<br>\n"; - echo " Fatal error in line ".$errline." of file ".$errfile; - echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\n"; - echo "Aborting...<br>\n"; - exit -1; + case E_USER_ERROR: + echo "<b>My ERROR</b> [$errno] $errstr<br />\n"; + echo " Fatal error in line $errline of file $errfile"; + echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; + echo "Aborting...<br />\n"; + exit(1); break; - case ERROR: - echo "<b>ERROR</b> [$errno] $errstr<br>\n"; + case E_USER_WARNING: + echo "<b>My WARNING</b> [$errno] $errstr<br />\n"; break; - case WARNING: - echo "<b>WARNING</b> [$errno] $errstr<br>\n"; + case E_USER_NOTICE: + echo "<b>My NOTICE</b> [$errno] $errstr<br />\n"; break; - default: - echo "Unkown error type: [$errno] $errstr<br>\n"; + default: + echo "Unkown error type: [$errno] $errstr<br />\n"; break; } } // エラー処理のテスト用関数 -function scale_by_log ($vect, $scale) { - if ( !is_numeric($scale) || $scale <= 0 ) - trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", - FATAL); +function scale_by_log($vect, $scale) +{ + if (!is_numeric($scale) || $scale <= 0) { + trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", E_USER_ERROR); + } + if (!is_array($vect)) { - trigger_error("Incorrect input vector, array of values expected", ERROR); + trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING); return null; } + for ($i=0; $i<count($vect); $i++) { if (!is_numeric($vect[$i])) - trigger_error("Value at position $i is not a number, using 0 (zero)", - WARNING); - $temp[$i] = log($scale) * $vect[$i]; + trigger_error("Value at position $i is not a number, using 0 (zero)", E_USER_NOTICE); + $temp[$i] = log($scale) * $vect[$i]; + } + return $temp; } - return $temp; -} // 定義したエラーハンドラを設定する $old_error_handler = set_error_handler("myErrorHandler"); // エラーを発生します。まず、数値でない項目が混ざった配列を定義します。 echo "vector a\n"; -$a = array(2,3,"foo",5.5,43.3,21.11); +$a = array(2,3, "foo", 5.5, 43.3, 21.11); print_r($a); -// 次に警告を発生するような2番目の配列を生成します。 +// 次に警告を発生するような 2 番目の配列を生成します。 echo "----\nvector b - a warning (b = log(PI) * a)\n"; $b = scale_by_log($a, M_PI); print_r($b); // 配列の代わりに文字列を渡しており、問題を発生します。 -echo &quot;----\nvector c - an error\n&quot;; -$c = scale_by_log(&quot;not array&quot;,2.3); +echo "----\nvector c - an error\n"; +$c = scale_by_log("not array", 2.3); var_dump($c); -// ゼロまたは負数の log が定義されないという致命的なエラーを発生します。 +// ゼロまたは負数の対数が定義されないという致命的なエラーを発生します。 echo "----\nvector d - fatal error\n"; $d = scale_by_log($a, -2.5); ?> ]]> </programlisting> - &example.outputs; + &example.outputs.similar; <screen> <![CDATA[ vector a @@ -241,48 +323,24 @@ ---- vector d - fatal error <b>FATAL</b> [256] log(x) for x <= 0 is undefined, you used: scale = -2.5<br /> - Fatal error in line 36 of file trigger_error.php, PHP 4.0.2 (Linux)<br /> +Fatal error in line 36 of file trigger_error.php, PHP 4.0.2 (Linux)<br /> Aborting...<br /> ]]> </screen> </example> </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - PHP の標準のエラーハンドラは完全にバイパスされることに注意して下 - さい。<function>error_reporting</function> の設定は影響せず、どの - ような場合でもユーザが設定したエラーハンドラがコールされます。た - だし、この場合でもハンドラで <function>error_reporting</function> - のカレントの値を読み、適当に動作させることは可能です。エラーを発 - 生した命令の前に <link - linkend="language.operators.errorcontrol">@ エラー制御演算子 - </link> が付加されている場合、この値は 0 となることには注意を要し - ます。 - </para> - <para> - ユーザハンドラ関数は、要すれば <function>die</function> をコール - する責任があることにも注意を要します。エラーハンドラ関数がリター - ンした場合、スクリプトの実行は、エラーを発生した命令の次の命令に - 継続されます。 - </para> - <note> - <para> - (ファイルアップロードのように)スクリプトが実行される前にエラーが発 - 生した場合、カスタムエラーハンドラはコールされません。 - これは、その時点では登録されていないためです。 - </para> - </note> - <note> - <para> - 二番目のパラメータ<parameter>error_types</parameter>は - PHP 5で追加されました。 - </para> - </note> - <para> - <function>error_reporting</function>, - <function>restore_error_handler</function>, - <function>trigger_error</function>, および - <link linkend="errorfunc.constants">エラーレベル定数</link> - も参照ください。 + <simplelist> + <member><function>error_reporting</function></member> + <member><function>restore_error_handler</function></member> + <member><function>trigger_error</function></member> + <member><link linkend="errorfunc.constants">エラーレベル定数</link></member> + <member>&seealso.callback;</member> + </simplelist> </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/restore-error-handler.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/errorfunc/functions/restore-error-handler.xml diff -u phpdoc-ja/reference/errorfunc/functions/restore-error-handler.xml:1.4 phpdoc-ja/reference/errorfunc/functions/restore-error-handler.xml:1.5 --- phpdoc-ja/reference/errorfunc/functions/restore-error-handler.xml:1.4 Sun Jan 2 02:23:31 2005 +++ phpdoc-ja/reference/errorfunc/functions/restore-error-handler.xml Sat Aug 13 19:57:46 2005 @@ -1,32 +1,91 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./ja/functions/errorfunc.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> - <refentry id="function.restore-error-handler"> - <refnamediv> - <refname>restore_error_handler</refname> - <refpurpose> - 以前のエラーハンドラ関数を回復する - </refpurpose> - </refnamediv> - <refsect1> - <title>説明</title> - <methodsynopsis> - <type>void</type><methodname>restore_error_handler</methodname> - <void/> - </methodsynopsis> - <para> - <function>set_error_handler</function>を使用してエラーハンドラ関 - 数を変更した後、元のエラーハンドラ(組込またはユーザ定義関数)に戻 - すために使用されます。 - </para> +<!-- EN-Revision: 1.12 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> +<refentry id="function.restore-error-handler"> + <refnamediv> + <refname>restore_error_handler</refname> + <refpurpose>以前のエラーハンドラ関数を回復する</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>bool</type><methodname>restore_error_handler</methodname> + <void/> + </methodsynopsis> + <para> + <function>set_error_handler</function> を使用してエラーハンドラ関数を + 変更した後、元のエラーハンドラ(組込またはユーザ定義関数)に戻すために + 使用されます。 + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + この関数は常に &true; を返します。 + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>restore_error_handler</function> の例</title> <para> - <function>error_reporting</function>, - <function>set_error_handler</function>, - <function>trigger_error</function>, - <function>user_error</function>も参照ください。 + <function>unserialize</function> がエラーを発生した場合に + 元のエラーハンドラに戻すことにする </para> - </refsect1> - </refentry> + <programlisting role="php"> +<![CDATA[ +<?php +function unserialize_handler($errno, $errstr) +{ + echo "Invalid serialized value.\n"; +} + +$serialized = 'foo'; +set_error_handler('unserialize_handler'); +$original = unserialize($serialized); +restore_error_handler(); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Invalid serialized value. +]]> + </screen> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <note> + <para> + <literal>error_handler</literal> 関数の中から + <function>restore_error_handler</function> がコールされた場合、 + それは無視されます。 + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>error_reporting</function></member> + <member><function>set_error_handler</function></member> + <member><function>restore_exception_handler</function></member> + <member><function>trigger_error</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/error-reporting.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-ja/reference/errorfunc/functions/error-reporting.xml diff -u phpdoc-ja/reference/errorfunc/functions/error-reporting.xml:1.4 phpdoc-ja/reference/errorfunc/functions/error-reporting.xml:1.5 --- phpdoc-ja/reference/errorfunc/functions/error-reporting.xml:1.4 Tue Nov 23 02:40:57 2004 +++ phpdoc-ja/reference/errorfunc/functions/error-reporting.xml Sat Aug 13 19:57:46 2005 @@ -1,36 +1,157 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.4 $ --> -<!-- EN-Revision: 1.11 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.5 $ --> +<!-- EN-Revision: 1.14 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.error-reporting"> <refnamediv> <refname>error_reporting</refname> - <refpurpose>出力するPHPエラーの種類を設定する</refpurpose> + <refpurpose>出力する PHP エラーの種類を設定する</refpurpose> </refnamediv> - <refsect1> + + <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>関数は、 + <function>error_reporting</function> 関数は、 <link linkend="ini.error-reporting">error_reporting</link> ディレクティブを - 実行時に設定します。PHPには多くのエラーレベルがあり、 + 実行時に設定します。PHP には多くのエラーレベルがあり、 この関数によりスクリプトの持続時間(実行時間)のレベルが設定されます。 </para> - <para> - <function>error_reporting</function>は、PHPのエラー出力 - レベルを設定し、元のレベルを返します。 - <parameter>level</parameter> パラメータは、ビットマスク - またあは名前付きの定数のどちらかをとります。 - 将来のバージョンとの互換性を保証するために、 - 名前付きの定数の使用が強く推奨されています。 - エラーレベルが追加された時、整数のレンジは増加します。 - このため、以前の整数を使用するエラーレベルは常に期待通 - りに動作するとは限りません。 + </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>に + 記述されています。 + <table> + <title><function>error_reporting</function> レベル定数とビット値</title> + <tgroup cols="2"> + <thead> + <row> + <entry>値</entry> + <entry>定数</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>2047</entry> + <entry> + <link linkend="e-all">E_ALL</link> + </entry> + </row> + <row> + <entry>2048</entry> + <entry> + <link linkend="e-strict">E_STRICT</link> + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </listitem> + </varlistentry> + </variablelist> </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; <para> - <example role="php"> + 変更前の <link linkend="ini.error-reporting">error_reporting</link> + レベルを返します。 + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> <title><function>error_reporting</function> の例</title> <programlisting role="php"> <![CDATA[ @@ -39,133 +160,53 @@ // 全てのエラー出力をオフにする error_reporting(0); -// Report simple running errors +// 単純な実行時エラーを表示する error_reporting(E_ERROR | E_WARNING | E_PARSE); -// Reporting E_NOTICE can be good too (to report uninitialized -// variables or catch variable name misspellings ...) +// E_NOTICE を表示させるのもおすすめ(初期化されていない +// 変数、変数名のスペルミスなど…) error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); -// Report all errors except E_NOTICE -// This is the default value set in php.ini +// E_NOTICE 以外の全てのエラーを表示する +// これは php.ini で設定されているデフォルト値 error_reporting(E_ALL ^ E_NOTICE); -// Report all PHP errors (bitwise 63 may be used in PHP 3) +// 全ての PHP エラーを表示する(ビット 63 は PHP 3 で利用される) error_reporting(E_ALL); -// Same as error_reporting(E_ALL); +// error_reporting(E_ALL); と同じ ini_set('error_reporting', E_ALL); + +?> ]]> </programlisting> </example> </para> - <para> - 利用可能なエラーレベル定数の一覧を以下に示します。 - これらのエラーの実際の意味は、 - <link linkend="errorfunc.constants">定義済みの定数</link>.に - 記述されています。 - <table> - <title><function>error_reporting</function>レベル定数とビット値</title> - <tgroup cols="2"> - <thead> - <row> - <entry>値</entry> - <entry>定数</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>2047</entry> - <entry> - <link linkend="e-all">E_ALL</link> - </entry> - </row> - <row> - <entry>2048</entry> - <entry> - <link linkend="e-strict">E_STRICT</link> - </entry> - </row> - </tbody> - </tgroup> - </table> - </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; <warning> <simpara> - PHP &gt; 5.0.0以降、値2048を有する<constant>E_STRICT</constant>が利用可能です。 - <constant>E_ALL</constant> には、エラーレベル - <constant>E_STRICT</constant>は含まれません。 + PHP &gt; 5.0.0 では、値 2048 を有する <constant>E_STRICT</constant> + が利用可能です。<constant>E_ALL</constant> には、エラーレベル + <constant>E_STRICT</constant> は含まれ<emphasis>ません</emphasis>。 + ほとんどの <constant>E_STRICT</constant> レベルのエラーはスクリプトの + コンパイル時に発生します。そのため、 + <link linkend="ini.error-reporting">error_reporting</link> で + <constant>E_STRICT</constant> を含むように設定されている環境では + これらのエラーを検出できません。 </simpara> </warning> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - <link linkend="ini.display-errors">display_errors</link> - <function>ini_set</function>. + <simplelist> + <member><link linkend="ini.display-errors">display_errors</link> ディレクティブ</member> + <member><function>ini_set</function></member> + </simplelist> </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/error-log.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-ja/reference/errorfunc/functions/error-log.xml diff -u phpdoc-ja/reference/errorfunc/functions/error-log.xml:1.3 phpdoc-ja/reference/errorfunc/functions/error-log.xml:1.4 --- phpdoc-ja/reference/errorfunc/functions/error-log.xml:1.3 Mon Nov 22 23:45:32 2004 +++ phpdoc-ja/reference/errorfunc/functions/error-log.xml Sat Aug 13 19:57:46 2005 @@ -1,111 +1,155 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./ja/functions/errorfunc.xml, last change in rev 1.1 --> -<!-- EN-Revision: 1.1 Maintainer: hirokawa Status: ready --> - <refentry id="function.error-log"> - <refnamediv> - <refname>error_log</refname> - <refpurpose>エラーメッセージを送信する</refpurpose> - </refnamediv> - <refsect1> - <title>説明</title> - <methodsynopsis> - <type>int</type><methodname>error_log</methodname> - <methodparam><type>string</type><parameter>message</parameter></methodparam> - <methodparam><type>int</type><parameter>message_type</parameter></methodparam> - <methodparam><type>string</type><parameter> - <replaceable><optional>destination</optional></replaceable> - </parameter></methodparam> - <methodparam><type>string</type><parameter> - <replaceable><optional>extra_headers</optional></replaceable> - </parameter></methodparam> - </methodsynopsis> - <para> - エラーメッセージを Web サーバのエラーログ、 - <acronym>TCP</acronym>ポート、ファイルのいずれかに送ります。 - 最初のパラメータ <parameter>message</parameter> はログされる - メッセージです。2 番目のパラメータ <parameter>message_type - </parameter> はメッセージをどこへ送るのかを指定します。 - <table> - <title><function>error_log</function> ログタイプ</title> - <tgroup cols="2"> - <tbody> - <row> - <entry>0</entry> - <entry> - <parameter>message</parameter> は、オペレーティング・システム - のシステムログのメカニズムまたはファイルのいずれかを使って - PHP のシステム・ロガーに送られます。どちらが使われるかは、 - <link linkend="ini.error-log">error_log</link> の設定 - ディレクティブにより決定されます。 - </entry> - </row> - <row> - <entry>1</entry> - <entry> - <parameter>message</parameter> は、<parameter>destination - </parameter> パラメータで指定されたアドレスに、電子メール - により送られます。このメッセージタイプの場合にのみ、 - 4 番目のパラメータである <parameter>extra_headers</parameter> - が使われます。このメッセージタイプは、<function>mail</function> - と同様に、同じ名前の内部関数を使用します。 - </entry> - </row> - <row> - <entry>2</entry> - <entry> - <parameter>message</parameter> は、PHP のデバッグ用コネクション - を通して送られます。このオプションは、 - <link linkend="install.configure.enable-debugger">リモートデ - バッグが有効になっている</link>場合のみ使用できます。このケー - スでは、<parameter>destination</parameter> パラメータにより、 - デバッグ情報を受け取るソケットのホスト名または IP アドレス、 - およびオプションでポート番号を指定します。 - </entry> - </row> - <row> - <entry>3</entry> - <entry> - <parameter>message</parameter> は <parameter>destination - </parameter> で指定されたファイルに追加されます。 - </entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <warning> - <para> - TCP/IP経由でのリモートデバッグは、PHP 3の機能であり、PHP 4では利 - 用できません。 - </para> - </warning> - <para> - <example role="php"> - <title><function>error_log</function> の例</title> - <programlisting role="php"> +<!-- EN-Revision: 1.13 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> +<refentry id="function.error-log"> + <refnamediv> + <refname>error_log</refname> + <refpurpose>エラーメッセージを送信する</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>bool</type><methodname>error_log</methodname> + <methodparam><type>string</type><parameter>message</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>message_type</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>destination</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>extra_headers</parameter></methodparam> + </methodsynopsis> + <para> + エラーメッセージを Web サーバのエラーログ、 + <acronym>TCP</acronym> ポート、あるいはファイルに送ります。 + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>message</parameter></term> + <listitem> + <para> + ログに記録されるエラーメッセージ。 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>message_type</parameter></term> + <listitem> + <para> + メッセージをどこに送るのかを指定します。以下の中から指定できます。 + </para> + <para> + <table> + <title><function>error_log</function> ログタイプ</title> + <tgroup cols="2"> + <tbody> + <row> + <entry>0</entry> + <entry> + <parameter>message</parameter> は、オペレーティング・システム + のシステムログのメカニズムまたはファイルのいずれかを使って + PHP のシステム・ロガーに送られます。どちらが使われるかは、 + 設定ディレクティブ <link linkend="ini.error-log">error_log</link> + の内容により決定されます。これはデフォルトのオプションです。 + </entry> + </row> + <row> + <entry>1</entry> + <entry> + <parameter>message</parameter> は、<parameter>destination + </parameter> パラメータで指定されたアドレスに、電子メール + により送られます。このメッセージタイプの場合にのみ、 + 4 番目のパラメータである <parameter>extra_headers</parameter> + が使われます。 + </entry> + </row> + <row> + <entry>2</entry> + <entry> + <parameter>message</parameter> は、PHP のデバッグ用接続を + 通して送られます。このオプションは、 + <link linkend="install.configure.enable-debugger"> + リモートデバッグが有効になっている</link>場合のみ使用できます。 + このケースでは、<parameter>destination</parameter> パラメータにより、 + デバッグ情報を受け取るソケットのホスト名または IP アドレス、 + およびオプションでポート番号を指定します。このオプションは PHP 3 + でのみ有効です。 + </entry> + </row> + <row> + <entry>3</entry> + <entry> + <parameter>message</parameter> は <parameter>destination + </parameter> で指定されたファイルに追加されます。 + 明示的に指定しない限り、<parameter>message</parameter> の + 最後には改行文字は追加されません。 + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>destination</parameter></term> + <listitem> + <para> + メッセージの送信先。その設定は、上で説明している + <parameter>message</parameter> パラメータの値によります。 + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>extra_headers</parameter></term> + <listitem> + <para> + 追加のヘッダ。<parameter>message</parameter> パラメータが + <literal>1</literal> に設定される場合に利用されます。 + このメッセージタイプは、<function>mail</function> と同様に + 内部関数を利用します。 + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example role="php"> + <title><function>error_log</function> の例</title> + <programlisting role="php"> <![CDATA[ +<?php // データベースに接続できない場合、 // サーバログを通してエラーを通知する。 -if (!Ora_Logon ($username, $password)) { - error_log ("オラクルのデータベースが使用できません!", 0); +if (!Ora_Logon($username, $password)) { + error_log("オラクルのデータベースが使用できません!", 0); } -// Foo に失敗したら、管理者に email で通知する -if (!($foo = allocate_new_foo()) { - error_log("大変です! FOO に失敗しました!", 1, - "operator@mydomain.com"); +// FOO に失敗したら、管理者に email で通知する +if (!($foo = allocate_new_foo())) { + error_log("大変です。FOO に失敗しました!", 1, + "operator@example.com"); } // これ以外の error_log() のコール方法: -error_log ("大変だ!", 2, "127.0.0.1:7000"); -error_log ("大変だ!", 2, "loghost"); -error_log ("大変だ!", 3, "/var/tmp/my-errors.log"); +error_log("大変だ!", 2, "127.0.0.1:7000"); +error_log("大変だ!", 2, "loghost"); +error_log("大変だ!", 3, "/var/tmp/my-errors.log"); +?> ]]> - </programlisting> - </example> - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/functions/debug-backtrace.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-ja/reference/errorfunc/functions/debug-backtrace.xml diff -u phpdoc-ja/reference/errorfunc/functions/debug-backtrace.xml:1.2 phpdoc-ja/reference/errorfunc/functions/debug-backtrace.xml:1.3 --- phpdoc-ja/reference/errorfunc/functions/debug-backtrace.xml:1.2 Sun Jan 2 02:23:31 2005 +++ phpdoc-ja/reference/errorfunc/functions/debug-backtrace.xml Sat Aug 13 19:57:46 2005 @@ -1,27 +1,34 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.15 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <refentry id="function.debug-backtrace"> <refnamediv> <refname>debug_backtrace</refname> - <refpurpose> - バックトレースを生成する - </refpurpose> + <refpurpose>バックトレースを生成する</refpurpose> </refnamediv> - <refsect1> - <title>説明</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>array</type><methodname>debug_backtrace</methodname> <void/> </methodsynopsis> <para> - <function>debug_backtrace</function>は、PHPバックトレースを生成し、 - この情報を連想配列として返します。返される可能性がある要素を以下の - 表に示します。 + <function>debug_backtrace</function> は PHP バックトレースを生成します。 + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + 連想配列を返します。連想配列の要素として返される可能性があるものは + 以下のとおりです。 </para> <para> <table> <title> - <function>debug_backtrace</function>から返される可能性がある要素 + <function>debug_backtrace</function> から返される可能性がある要素 </title> <tgroup cols="3"> <thead> @@ -73,7 +80,9 @@ <entry>type</entry> <entry><type>string</type></entry> <entry> - カレントのクラス型。 + カレントのコール方式。メソッド呼び出しの場合は "->"、静的なメソッド + 呼び出しの場合は "::" が返されます。関数呼び出しの場合は + 何も返されません。 </entry> </row> <row> @@ -89,40 +98,43 @@ </tgroup> </table> </para> - <para> - 以下に簡単な例を示します。 - </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> <example> - <title> - <function>debug_backtrace</function>の例 - </title> + <title><function>debug_backtrace</function> の例</title> <programlisting role="php"> <![CDATA[ -// ファイル名: a.php <?php +// ファイル名: a.php -function a_test($str) { - - print "\nHi: $str"; - +function a_test($str) +{ + echo "\nHi: $str"; var_dump(debug_backtrace()); } a_test('friend'); ?> -// ファイル名: b.php <?php +// ファイル名: b.php include_once '/tmp/a.php'; ?> - -/* /tmp/b.php を実行した際の結果 - +]]> + </programlisting> + <para> + <filename>/tmp/b.php</filename> を実行した際の結果は + 以下のようになります。 + </para> + <screen> +<![CDATA[ Hi: friend array(2) { - [0]=> - array(4) { +[0]=> +array(4) { ["file"] => string(10) "/tmp/a.php" ["line"] => int(10) ["function"] => string(6) "a_test" @@ -130,25 +142,31 @@ array(1) { [0] => &string(6) "friend" } - } - [1]=> - array(4) { +} +[1]=> +array(4) { ["file"] => string(10) "/tmp/b.php" ["line"] => int(2) - ["args"] => + ["args"] => array(1) { [0] => string(10) "/tmp/a.php" } ["function"] => string(12) "include_once" } } -*/ ]]> - </programlisting> + </screen> </example> </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - <function>trigger_error</function>も参照してください。 + <simplelist> + <member><function>trigger_error</function></member> + <member><function>debug_print_backtrace</function></member> + </simplelist> </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc-ja/reference/errorfunc/ini.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc-ja/reference/errorfunc/ini.xml diff -u phpdoc-ja/reference/errorfunc/ini.xml:1.5 phpdoc-ja/reference/errorfunc/ini.xml:1.6 --- phpdoc-ja/reference/errorfunc/ini.xml:1.5 Sun Jan 2 02:23:31 2005 +++ phpdoc-ja/reference/errorfunc/ini.xml Sat Aug 13 19:57:46 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.20 Maintainer: hirokawa Status: ready --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.28 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: takagi --> <section id="errorfunc.configuration"> &reftitle.runtime; &extension.runtime; @@ -13,94 +14,110 @@ <entry>名前</entry> <entry>デフォルト</entry> <entry>変更の可否</entry> + <entry>変更履歴</entry> </row> </thead> <tbody> <row> <entry>error_reporting</entry> - <entry>E_ALL &amp; ~E_NOTICE</entry> + <entry>NULL</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>display_errors</entry> <entry>"1"</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>display_startup_errors</entry> <entry>"0"</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.0.3 以降で有効です。</entry> </row> <row> <entry>log_errors</entry> <entry>"0"</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>log_errors_max_len</entry> <entry>"1024"</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.3.0 以降で有効です。</entry> </row> <row> <entry>ignore_repeated_errors</entry> <entry>"0"</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.3.0 以降で有効です。</entry> </row> <row> <entry>ignore_repeated_source</entry> <entry>"0"</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.3.0 以降で有効です。</entry> </row> <row> <entry>report_memleaks</entry> <entry>"1"</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.3.0 以降で有効です。</entry> </row> <row> <entry>track_errors</entry> <entry>"0"</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>html_errors</entry> <entry>"1"</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP &lt;= 4.2.3 では PHP_INI_SYSTEM 。PHP 4.0.2 以降で有効です。</entry> </row> <row> <entry>docref_root</entry> <entry>""</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.3.0 以降で有効です。</entry> </row> <row> <entry>docref_ext</entry> <entry>""</entry> <entry>PHP_INI_ALL</entry> + <entry>PHP 4.3.2 以降で有効です。</entry> </row> <row> <entry>error_prepend_string</entry> <entry>NULL</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>error_append_string</entry> <entry>NULL</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>error_log</entry> <entry>NULL</entry> <entry>PHP_INI_ALL</entry> + <entry></entry> </row> <row> <entry>warn_plus_overloading</entry> <entry>NULL</entry> <entry>PHP_INI??</entry> + <entry></entry> </row> </tbody> </tgroup> </table> - PHP_INI_* 定数の詳細および定義については、 - <function>ini_set</function>を参照してください。 + &ini.php.constants; </para> <para> 以下に設定ディレクティブの簡単な説明を示します。 @@ -174,6 +191,14 @@ 使用すべきではありません。(例えばインターネットに接続されたシステムなど) </para> </note> + <note> + <para> + display_errors は実行時にも設定可能(<function>ini_set</function> + 関数を用いて)ですが、スクリプトが致命的(fatal)なエラーを発生した場合は + その設定は反映されません。なぜなら、要求されたアクションは + 実行されなかったからです。 + </para> + </note> </listitem> </varlistentry> @@ -220,10 +245,10 @@ <para> log_errorsの最大長をキロバイト単位で設定します。 <link linkend="ini.error-log">error_log</link> には、 - この設定で情報が追加されます。デフォルトは1024で、0を指定すると + この設定で情報が追加されます。デフォルトは 1024 で、0 を指定すると 最大長の制限は全く適用されなくなります。 この長さはエラーログに記録され、 - エラー表示と<link + エラー表示と <link linkend="reserved.variables.phperrormsg">$php_errormsg</link> に適用されます。 </para> @@ -385,11 +410,11 @@ <para> スクリプトエラーが記録されるファイル名です。 ファイルはウェブサーバユーザで書き込めなければなりません。 - <literal>syslog</literal>が指定されると、エラーはファイルではなく - システムロガーに送られます。これはUNIXではsyslog(3)であり - Windows NTではイベントログのことです。システムロガーは - Windows95ではサポートされていません。 - <function>syslog</function>も参照してください。 + <literal>syslog</literal> が指定されると、エラーはファイルではなく + システムロガーに送られます。これは UNIX では syslog(3) であり + Windows NT ではイベントログのことです。システムロガーは + Windows 95 ではサポートされていません。 + <function>syslog</function> も参照してください。 </para> </listitem> </varlistentry>
« previous php.doc.ja (#1122) next »