[PHP-DOC] cvs: phpdoc /en/functions info.xml From: Ron Chmara (ron <email protected>)
Date: 08/31/00

ronabop Wed Aug 30 22:17:42 2000 EDT

  Modified files:
    /phpdoc/en/functions info.xml
  Log:
  Took a swing at updating info on text-based errors. Please scrutinize.
  
Index: phpdoc/en/functions/info.xml
diff -u phpdoc/en/functions/info.xml:1.26 phpdoc/en/functions/info.xml:1.27
--- phpdoc/en/functions/info.xml:1.26 Tue Aug 29 06:02:11 2000
+++ phpdoc/en/functions/info.xml Wed Aug 30 22:17:42 2000
@@ -236,15 +236,33 @@
     <funcsynopsis>
      <funcprototype>
       <funcdef>int <function>error_reporting</function></funcdef>
- <paramdef>int
+ <paramdef>mixed
        <parameter><optional>level</optional></parameter>
       </paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
      Sets PHP's error reporting level and returns the old level. The
- error reporting level is a bitmask of the following values
- (follow the links for the internal values to get their meanings):
+ error reporting level is either a bitmask or text string. Using
+ text strings is strongly encouraged to ensure compatibility for
+ future versions. As error levels are added, the range of integers
+ increases, so older integer-based error levels will not always
+ behave as expected.
+ <example role="php">
+ <title>Error Integer changes</title>
+ <programlisting role="php">
+error_reporting(55); // PHP 3 equivalent to E_ALL ^ E_NOTICE
+
+/* ...in PHP 4, '55' would mean (E_ERROR | E_WARNING | E_PARSE |
+E_CORE_ERROR | E_CORE_WARNING) */
+
+error_reporting(2039); // PHP 4 equivalent to E_ALL ^ E_NOTICE
+
+error_reporting(E_ALL ^ E_NOTICE); // The same in both PHP 3 and 4
+ </programlisting>
+ </example>
+
+ Follow the links for the internal values to get their meanings:
      <table>
       <title><function>error_reporting</function> bit values</title>
       <tgroup cols="2">
@@ -291,6 +309,18 @@
       <link linkend="internal.e-core-warning">E_CORE_WARNING</link>
      </entry>
     </row>
+ <row>
+ <entry>64</entry>
+ <entry>
+ <link linkend="internal.e-compile-error">E_COMPILE_ERROR</link>
+ </entry>
+ </row>
+ <row>
+ <entry>128</entry>
+ <entry>
+ <link linkend="internal.e-compile-warning">E_COMPILE_WARNING</link>
+ </entry>
+ </row>
        </tbody>
       </tgroup>
      </table>
@@ -300,19 +330,19 @@
       <title><function>error_reporting</function> examples</title>
       <programlisting role="php">
 error_reporting(0);
-// Turn off all reporting
+/* Turn off all reporting */
+
+error_reporting(7); // Old syntax, PHP 2/3
+error_reporting(E_ERROR | E_WARNING | E_PARSE); // New syntax for PHP 3/4
+/* Good to use for simple running errors */
 
-error_reporting(7);
-// E_ERROR, E_WARNING, and E_PARSE
-// 1+2+4 = 7, for basic running errors
-
-error_reporting(15);
-// E_ERROR, E_WARNING, E_PARSE, and E_NOTICE
-// 1+2+4+8 = 15, good for code authoring to report
-// uninitialized (possibly mis-spelled) variables
+error_reporting(15); // Old syntax, PHP 2/3
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // New syntax for PHP 3/4
+/* good for code authoring to report uninitialized or (possibly mis-spelled) variables */
 
-error_reporting(63);
-// report all PHP errors, rarely used.
+error_reporting(63); // Old syntax, PHP 2/3
+error_reporting(E_ALL); // New syntax for PHP3/4
+/* report all PHP errors */
       </programlisting>
      </example>
     </para>