Skip to content

wikimedia/mediawiki-php-wmerrors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an extension for enhancing and customising the handling of PHP errors.

Compile and install it in the usual way, there are no special dependencies:

  phpize
  ./configure
  make
  make install

The options are:

wmerrors.enabled

    Set this to true to enable custom error handling. This allows the extension
    to be disabled with ini_set() at any time before the fatal error is
    generated.

wmerrors.message_file

	Set this to the path to an HTML file which you wish to be displayed to your
    users. A sample HTML file is distributed with this extension in error.html.

    If this is set, display_errors should be disabled to prevent a duplicate
    message from being shown.

    The error HTML may contain the following special variables, which will be
    replaced with the appropriate values when the error message is generated.
    Unlike PHP's display_errors, these values will be properly escaped to avoid
    XSS:

        - $file:     The filename in which the error occurred
        - $line:     The line number at which the error occurred
        - $message:  The error message

wmerrors.error_script_file

	Set this to the path to a PHP file which will be executed in the event of a
	fatal error.

	If the script file outputs an error message, display_errors should be disabled
	to prevent a duplicate message from being shown.

wmerrors.log_file

    The name of a file to send error reports to. This is similar to PHP's
    error_log, except that it provides several additional features. Logging to
    a TCP or UDP network socket is also supported, using a URL of the form:

       udp://<host>:<port>
       tcp://<host>:<port>

    For example:

       udp://logger.example.com:8420

wmerrors.log_backtrace

    Set this to true if you want the error report sent to wmerrors.log_file to
    include a backtrace.

wmerrors.ignore_logging_errors

    If an error is encountered while opening or writing to the file specified
    in wmerrors.log_file, then the error will be ignored if this is set to
    true. If it is set to false, the error will be handled with PHP's standard
    error handling, and so will be available via display_errors or error_log.

wmerrors.backtrace_in_php_error_message

    If this is true, a concise backtrace, listing base filenames (not including
    the path) and line numbers only, will be included in the error message
    which is passed through to PHP, for output into error_log.