mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 03:54:10 +01:00
[ticket/10057] Moved error collector class into its own file.
This will make it autoloadable in 3.1. This commit breaks 3.0 since no code includes the error collector. Such include code will be in its own commit since it will need to be reverted in 3.1. PHPBB3-10057
This commit is contained in:
parent
17693c2802
commit
24834543ee
45
phpBB/includes/error_collector.php
Normal file
45
phpBB/includes/error_collector.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
class phpbb_error_collector
|
||||
{
|
||||
var $errors;
|
||||
|
||||
function phpbb_error_collector()
|
||||
{
|
||||
$this->errors = array();
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
set_error_handler(array(&$this, 'error_handler'));
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
function error_handler($errno, $msg_text, $errfile, $errline)
|
||||
{
|
||||
$this->errors[] = array($errno, $msg_text, $errfile, $errline);
|
||||
}
|
||||
|
||||
function format_errors()
|
||||
{
|
||||
$text = '';
|
||||
foreach ($this->errors as $error)
|
||||
{
|
||||
if (!empty($text))
|
||||
{
|
||||
$text .= "<br />\n";
|
||||
}
|
||||
list($errno, $msg_text, $errfile, $errline) = $error;
|
||||
$text .= "Errno $errno: $msg_text";
|
||||
if (defined('DEBUG'))
|
||||
{
|
||||
$text .= " at $errfile line $errline";
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
}
|
@ -3928,50 +3928,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||
return false;
|
||||
}
|
||||
|
||||
class phpbb_error_collector
|
||||
{
|
||||
var $errors;
|
||||
|
||||
function phpbb_error_collector()
|
||||
{
|
||||
$this->errors = array();
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
set_error_handler(array(&$this, 'error_handler'));
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
function error_handler($errno, $msg_text, $errfile, $errline)
|
||||
{
|
||||
$this->errors[] = array($errno, $msg_text, $errfile, $errline);
|
||||
}
|
||||
|
||||
function format_errors()
|
||||
{
|
||||
$text = '';
|
||||
foreach ($this->errors as $error)
|
||||
{
|
||||
if (!empty($text))
|
||||
{
|
||||
$text .= "<br />\n";
|
||||
}
|
||||
list($errno, $msg_text, $errfile, $errline) = $error;
|
||||
$text .= "Errno $errno: $msg_text";
|
||||
if (defined('DEBUG'))
|
||||
{
|
||||
$text .= " at $errfile line $errline";
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries the session table to get information about online guests
|
||||
* @param int $item_id Limits the search to the item with this id
|
||||
|
Loading…
x
Reference in New Issue
Block a user