Vergleich inc/class_error.php - 1.6.2 - 1.6.17

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: class_error.php 5027 2010-06-16 04:22:21Z RyanGordon $

 * $Id$

 */

// Set to 1 if recieving a blank page (template failure).

 */

// Set to 1 if recieving a blank page (template failure).

Zeile 22Zeile 22
define("MYBB_SQL_LOAD_ERROR", 44);
define("MYBB_CACHE_NO_WRITE", 45);
define("MYBB_CACHEHANDLER_LOAD_ERROR", 46);

define("MYBB_SQL_LOAD_ERROR", 44);
define("MYBB_CACHE_NO_WRITE", 45);
define("MYBB_CACHEHANDLER_LOAD_ERROR", 46);


if(!defined("E_STRICT"))
{
// This constant has been defined since PHP 5.
define("E_STRICT", 2048);
}

 

if(!defined("E_RECOVERABLE_ERROR"))


if(!defined("E_RECOVERABLE_ERROR"))

{

{

	// This constant has been defined since PHP 5.2.
define("E_RECOVERABLE_ERROR", 4096);
}


	// This constant has been defined since PHP 5.2.
define("E_RECOVERABLE_ERROR", 4096);
}


if(!defined("E_DEPRECATED"))







if(!defined("E_DEPRECATED"))
{
// This constant has been defined since PHP 5.3.
define("E_DEPRECATED", 8192);
}

if(!defined("E_USER_DEPRECATED"))

{
// This constant has been defined since PHP 5.3.

{
// This constant has been defined since PHP 5.3.

	define("E_DEPRECATED", 8192);

	define("E_USER_DEPRECATED", 16384);

}

class errorHandler {

}

class errorHandler {

Zeile 49Zeile 49
	 * @var array
*/
public $error_types = array(

	 * @var array
*/
public $error_types = array(

		E_ERROR              => 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core Error',
E_CORE_WARNING => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',
E_DEPRECATED => 'Deprecated Warning',
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
MYBB_SQL => 'MyBB SQL Error',
MYBB_TEMPLATE => 'MyBB Template Error',
MYBB_GENERAL => 'MyBB Error',
MYBB_NOT_INSTALLED => 'MyBB Error',
MYBB_NOT_UPGRADED => 'MyBB Error',
MYBB_INSTALL_DIR_EXISTS => 'MyBB Error',
MYBB_SQL_LOAD_ERROR => 'MyBB Error',
MYBB_CACHE_NO_WRITE => 'MyBB Error',
MYBB_CACHEHANDLER_LOAD_ERROR => 'MyBB Error',


		E_ERROR							=> 'Error',
E_WARNING => 'Warning',
E_PARSE => 'Parsing Error',
E_NOTICE => 'Notice',
E_CORE_ERROR => 'Core Error',
E_CORE_WARNING => 'Core Warning',
E_COMPILE_ERROR => 'Compile Error',
E_COMPILE_WARNING => 'Compile Warning',
E_DEPRECATED => 'Deprecated Warning',
E_USER_ERROR => 'User Error',
E_USER_WARNING => 'User Warning',
E_USER_NOTICE => 'User Notice',
E_USER_DEPRECATED => 'User Deprecated Warning',
E_STRICT => 'Runtime Notice',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
MYBB_SQL => 'MyBB SQL Error',
MYBB_TEMPLATE => 'MyBB Template Error',
MYBB_GENERAL => 'MyBB Error',
MYBB_NOT_INSTALLED => 'MyBB Error',
MYBB_NOT_UPGRADED => 'MyBB Error',
MYBB_INSTALL_DIR_EXISTS => 'MyBB Error',
MYBB_SQL_LOAD_ERROR => 'MyBB Error',
MYBB_CACHE_NO_WRITE => 'MyBB Error',
MYBB_CACHEHANDLER_LOAD_ERROR => 'MyBB Error',

	);

/**

	);

/**

Zeile 119Zeile 120
	
/**
* Initializes the error handler

	
/**
* Initializes the error handler

	 *

	 *

	 */
function __construct()
{

	 */
function __construct()
{

Zeile 128Zeile 129
		foreach($this->ignore_types as $bit)
{
$error_types = $error_types & ~$bit;

		foreach($this->ignore_types as $bit)
{
$error_types = $error_types & ~$bit;

		}


		}
error_reporting($error_types);

		set_error_handler(array(&$this, "error"), $error_types);
}


		set_error_handler(array(&$this, "error"), $error_types);
}


Zeile 154Zeile 156
		if(in_array($type, $this->ignore_types))
{
return true;

		if(in_array($type, $this->ignore_types))
{
return true;

		}


		}


		$file = str_replace(MYBB_ROOT, "", $file);

$this->has_errors = true;

		$file = str_replace(MYBB_ROOT, "", $file);

$this->has_errors = true;

		

		

		// For some reason in the installer this setting is set to "<"
$accepted_error_types = array('both', 'error', 'warning', 'none');
if(!in_array($mybb->settings['errortypemedium'], $accepted_error_types))

		// For some reason in the installer this setting is set to "<"
$accepted_error_types = array('both', 'error', 'warning', 'none');
if(!in_array($mybb->settings['errortypemedium'], $accepted_error_types))

		{

		{

			$mybb->settings['errortypemedium'] = "both";
}

if(defined("IN_TASK"))

			$mybb->settings['errortypemedium'] = "both";
}

if(defined("IN_TASK"))

		{

		{

			global $task;

require_once MYBB_ROOT."inc/functions_task.php";

			global $task;

require_once MYBB_ROOT."inc/functions_task.php";

			

			

			if($file)
{
$filestr = " - Line: $line - File: $file";

			if($file)
{
$filestr = " - Line: $line - File: $file";

Zeile 189Zeile 191

// Are we emailing the Admin a copy?
if($mybb->settings['errorlogmedium'] == "mail" || $mybb->settings['errorlogmedium'] == "both")


// Are we emailing the Admin a copy?
if($mybb->settings['errorlogmedium'] == "mail" || $mybb->settings['errorlogmedium'] == "both")

		{

		{

			$this->email_error($type, $message, $file, $line);
}


			$this->email_error($type, $message, $file, $line);
}


Zeile 295Zeile 297
	 *
* @param string Message
* @param string Type

	 *
* @param string Message
* @param string Type

	 */

	 */

	function trigger($message="", $type=E_USER_ERROR)
{
global $lang;

	function trigger($message="", $type=E_USER_ERROR)
{
global $lang;

Zeile 303Zeile 305
		if(!$message)
{
$message = $lang->unknown_user_trigger;

		if(!$message)
{
$message = $lang->unknown_user_trigger;

		}


		}


		if(in_array($type, $this->mybb_error_types))
{
$this->error($type, $message);

		if(in_array($type, $this->mybb_error_types))
{
$this->error($type, $message);

Zeile 326Zeile 328
	function log_error($type, $message, $file, $line)
{
global $mybb;

	function log_error($type, $message, $file, $line)
{
global $mybb;





		if($type == MYBB_SQL)
{
$message = "SQL Error: {$message['error_no']} - {$message['error']}\nQuery: {$message['query']}";
}

		if($type == MYBB_SQL)
{
$message = "SQL Error: {$message['error_no']} - {$message['error']}\nQuery: {$message['query']}";
}

 

// Do not log something that might be executable
$message = str_replace('<?', '< ?', $message);


		$error_data = "<error>\n";
$error_data .= "\t<dateline>".TIME_NOW."</dateline>\n";
$error_data .= "\t<script>".$file."</script>\n";

		$error_data = "<error>\n";
$error_data .= "\t<dateline>".TIME_NOW."</dateline>\n";
$error_data .= "\t<script>".$file."</script>\n";

Zeile 392Zeile 398
			$error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";
if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE"))
{

			$error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";
if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error" || defined("IN_INSTALL") || defined("IN_UPGRADE"))
{

 
				$message['query'] = htmlspecialchars_uni($message['query']);
$message['error'] = htmlspecialchars_uni($message['error']);

				$error_message .= "<dl>\n";
$error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n";
if($message['query'] != "")

				$error_message .= "<dl>\n";
$error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n";
if($message['query'] != "")

Zeile 591Zeile 599

foreach($trace as $call)
{


foreach($trace as $call)
{

				if(!$call['file']) $call['file'] = "[PHP]";
if(!$call['line']) $call['line'] = "&nbsp;";
if($call['class']) $call['function'] = $call['class'].$call['type'].$call['function'];

				if(empty($call['file'])) $call['file'] = "[PHP]";
if(empty($call['line'])) $call['line'] = "&nbsp;";
if(!empty($call['class'])) $call['function'] = $call['class'].$call['type'].$call['function'];

				$call['file'] = str_replace(MYBB_ROOT, "/", $call['file']);
$backtrace .= "<tr>\n";
$backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n";

				$call['file'] = str_replace(MYBB_ROOT, "/", $call['file']);
$backtrace .= "<tr>\n";
$backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n";