Skip to content

Commit

Permalink
Revise default $g_display_errors setting
Browse files Browse the repository at this point in the history
The default now reflects the recommended Production settings, and a
better recommendation for developers is documented in the phpDoc
comment block.

Fixes #17501
  • Loading branch information
dregad committed Aug 7, 2014
1 parent 17cb6c1 commit e788e93
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 35 deletions.
35 changes: 17 additions & 18 deletions config_defaults_inc.php
Expand Up @@ -4072,34 +4072,33 @@

/**
* Errors Display method
* Defines what errors are displayed and how. Available options are:
* - DISPLAY_ERROR_HALT stop and display error message (including
* Defines what {@link http://php.net/errorfunc.constants errors}
* are displayed and how. Available options are:
* - DISPLAY_ERROR_HALT Stop and display error message (including
* variables and backtrace if
* {@link $g_show_detailed_errors} is ON)
* - DISPLAY_ERROR_INLINE display 1 line error and continue execution
* - DISPLAY_ERROR_NONE no error displayed
* {@link $g_show_detailed_errors} is ON).
* - DISPLAY_ERROR_INLINE Display a one line error and continue execution.
* - DISPLAY_ERROR_NONE Suppress the error (no display). This is the default
* behavior for unspecified errors constants.
*
* The default settings are recommended for use in Production, and will only
* display MantisBT fatal errors, suppressing output of all other error types.
*
* Recommended config_inc.php settings for developers:
* $g_display_errors = array(
* E_USER_ERROR => DISPLAY_ERROR_HALT,
* E_WARNING => DISPLAY_ERROR_HALT,
* E_ALL => DISPLAY_ERROR_INLINE,
* );
*
* WARNING: E_USER_ERROR should always be set to DISPLAY_ERROR_HALT. Using
* another value will cause program execution to continue, which may lead to
* data integrity issues and/or cause MantisBT to function incorrectly.
*
* A developer might set this in config/config_inc.php as:
* $g_display_errors = array(
* E_WARNING => DISPLAY_ERROR_HALT,
* E_NOTICE => DISPLAY_ERROR_INLINE,
* E_USER_ERROR => DISPLAY_ERROR_HALT,
* E_USER_WARNING => DISPLAY_ERROR_INLINE,
* E_USER_NOTICE => DISPLAY_ERROR_INLINE
* );
*
* @global array $g_display_errors
*/
$g_display_errors = array(
E_WARNING => DISPLAY_ERROR_INLINE,
E_NOTICE => DISPLAY_ERROR_NONE,
E_USER_ERROR => DISPLAY_ERROR_HALT,
E_USER_WARNING => DISPLAY_ERROR_INLINE,
E_USER_NOTICE => DISPLAY_ERROR_NONE
);

/**
Expand Down
46 changes: 29 additions & 17 deletions docbook/Admin_Guide/en-US/Configuration.xml
Expand Up @@ -3471,61 +3471,73 @@ $g_main_menu_custom_options = array(
<term>$g_display_errors</term>
<listitem>
<para>Errors Display Method.
Defines what errors are displayed and how.
Defines what <ulink url="http://php.net/errorfunc.constants">
errors</ulink>
are displayed and how.
Available options are:
</para>

<variablelist>
<varlistentry>
<term>DISPLAY_ERROR_HALT</term>
<listitem>
<para>stop and display error message
<para>Stop and display the error message
(including variables and backtrace if
<emphasis>$g_show_detailed_errors</emphasis>
is ON)
is ON).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DISPLAY_ERROR_INLINE</term>
<listitem>
<para>display 1 line error and continue
execution
<para>Display a one line error and continue
execution.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DISPLAY_ERROR_NONE</term>
<listitem>
<para>no error displayed</para>
<para>Suppress the error (no display).
This is the default behavior for unspecified
<ulink url="http://php.net/errorfunc.constants">
errors constants</ulink>.
</para>
</listitem>
</varlistentry>
</variablelist>

<para>Default is</para>
<para>The default settings, recommended for use in Production,
will only display MantisBT fatal errors and suppress
output of all other error types:
<programlisting>
$g_display_errors = array(
E_WARNING => DISPLAY_ERROR_INLINE,
E_NOTICE => DISPLAY_ERROR_NONE,
E_USER_ERROR => DISPLAY_ERROR_HALT,
E_USER_WARNING => DISPLAY_ERROR_INLINE,
E_USER_NOTICE => DISPLAY_ERROR_NONE
);
</programlisting>
<para>A developer might set this in their
<filename>config_inc.php</filename> as:
</para>
<para>Recommended <filename>config_inc.php</filename>
settings for developers:
<programlisting>
$g_display_errors = array(
E_USER_ERROR => DISPLAY_ERROR_HALT,
E_WARNING => DISPLAY_ERROR_HALT,
E_NOTICE => DISPLAY_ERROR_INLINE,
E_ALL => DISPLAY_ERROR_INLINE,
);
</programlisting>
</para>
<para>Less intrusive settings, recommended for testing purposes:
<programlisting>
$g_display_errors = array(
E_USER_ERROR => DISPLAY_ERROR_HALT,
E_USER_WARNING => DISPLAY_ERROR_INLINE,
E_USER_NOTICE => DISPLAY_ERROR_INLINE
E_WARNING => DISPLAY_ERROR_INLINE,
);
</programlisting>
</para>
<warning><para><emphasis>E_USER_ERROR</emphasis>
should always be set to
<warning><para><literal>E_USER_ERROR</literal>
should <emphasis>always</emphasis> be set to
<literal>DISPLAY_ERROR_HALT</literal>.
Using any other value will cause program execution
to continue despite the error, which may lead to data
Expand Down

0 comments on commit e788e93

Please sign in to comment.