2011-03-06 20:14:06 -05:00
|
|
|
<?php
|
2011-03-08 19:48:56 -05:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package phpBB
|
|
|
|
* @copyright (c) 2011 phpBB Group
|
2011-12-31 13:32:52 +00:00
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
2011-03-08 19:48:56 -05:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
2011-03-06 20:14:06 -05:00
|
|
|
|
|
|
|
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";
|
|
|
|
}
|
2011-09-18 00:55:24 +02:00
|
|
|
|
2011-03-06 20:14:06 -05:00
|
|
|
list($errno, $msg_text, $errfile, $errline) = $error;
|
2011-09-18 00:55:24 +02:00
|
|
|
|
|
|
|
// Prevent leakage of local path to phpBB install
|
2011-09-18 22:32:25 +02:00
|
|
|
$errfile = phpbb_filter_root_path($errfile);
|
2011-09-18 00:55:24 +02:00
|
|
|
|
|
|
|
$text .= "Errno $errno: $msg_text at $errfile line $errline";
|
2011-03-06 20:14:06 -05:00
|
|
|
}
|
2011-09-18 00:55:24 +02:00
|
|
|
|
2011-03-06 20:14:06 -05:00
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
}
|