Project

General

Profile

Feature #19336 » 9355v9.diff

Administrator Admin, 2009-09-29 19:06

View differences:

t3lib/class.t3lib_exception.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* An exception
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: Exception.php 2813 2009-07-16 14:02:34Z k-fish $
*/
class t3lib_exception extends Exception {
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_exception.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_exception.php']);
}
?>
t3lib/config_default.php (Arbeitskopie)
'dbClientCompress' => 0, // Boolean: if true, data exchange between TYPO3 and database server will be compressed. This may improve performance if (1) database serever is on the different server and (2) network connection speed to database server is 100mbps or less. CPU usage will be higher if this option is used but database operations will be executed faster due to much less (up to 3 times) database network traffic. This option has no effect if MySQL server is localhost.
'setMemoryLimit' => 0, // Integer, memory_limit in MB: If more than 16, TYPO3 will try to use ini_set() to set the memory limit of PHP to the value. This works only if the function ini_set() is not disabled by your sysadmin.
'forceReturnPath' => 0, // Boolean: Force return path to be applied in mail() calls. If this is set, all calls to mail() done by t3lib_htmlmail will be called with '-f<return_path> as the 5th parameter. This will make the return path correct on almost all Unix systems. There is a known problem with Postfix below version 2: Mails are not sent if this option is set and Postfix is used. On Windows platforms, the return path is set via a call to ini_set. This has no effect if safe_mode in PHP is on.
'displayErrors' => -1, // Integer, -1,0,1,2. 0=Do not display any PHP error messages. 1=Display error messages. 2=Display only if client matches TYPO3_CONF_VARS[SYS][devIPmask]. -1=Default setting. With this option, you can override the PHP setting "display_errors". It is suggested that you set this to "0" and enable the "error_log" option in php.ini instead.
'serverTimeZone' => 1, // Integer, GMT offset of servers time (from time()). Default is "1" which is "GMT+1" (central european time). This value can be used in extensions that are GMT aware and wants to convert times to/from other timezones.
'systemLog' => '', // String, semi-colon separated list: Defines one or more logging methods. Possible methods: file,<abs-path-to-file>[,<level>];mail,<to>[/<from>][,<level>];syslog,<facility>,[,<level>];error_log[,,<level>]. "file" logs to a file, "mail" sends the log entries via mail, "syslog" uses the operating system's log, "error_log" uses the PHP error log. The level is the individual logging level (see [SYS][systemLogLevel]. Facility may be one of LOCAL0..LOCAL7, USER (on Windows USER is the only valid type).
'systemLogLevel' => 0, // Integer: Only messages with same or higher severity are logged; 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error.
......
)
),
'useCachingFramework' => 0, // Boolean: Enable this if you want to use the caching framework by default for the core caches cache_pages, cache_pagesection and cache_hash.
'displayErrors' => -1, // Integer, -1,0,1,2. 0=Do not display any PHP error messages. 1=Display error messages. 2=Display only if client matches TYPO3_CONF_VARS[SYS][devIPmask]. -1=Default setting. With this option, you can override the PHP setting "display_errors". It is suggested that you set this to "0" and enable the "error_log" option in php.ini instead.
'exceptionHandler' => 't3lib_error_ProductionExceptionHandler', // String: Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling, or set to t3lib_error_ProductionExceptionHandler for nice error messages when something wents wrong, or to t3lib_error_DebugExceptionHandler for a complete stack trace of any encountered exception. Note that if devIPmask matches, t3lib_error_DebugExceptionHandler will be used, regardless of this setting.
'errorHandler' => 't3lib_error_ErrorHandler', // String: Classname to handle PHP errors. The default will turn the error into an exception (to be handled by the exceptionHandler).
'exceptionalErrors' => E_ALL ^ E_NOTICE, // Integer: The E_* constant that will be handled as an exception by t3lib_error_ErrorHandler. Default is "E_ALL ^ E_NOTICE" (6135) and "0" if displayError=0. Some values for errors: E_ALL=6143, E_ALL ^ E_NOTICE ^ E_WARNING=6133. See php documentation for more details on this integer.
),
'EXT' => Array ( // Options related to the Extension Management
'noEdit' => 1, // Boolean: If set, the Extension Manager does NOT allow extension files to be edited! (Otherwise both local and global extensions can be edited.)
......
// Init services array:
$T3_SERVICES = array();
// Error & exception handling
$TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler'] = $TYPO3_CONF_VARS['SYS']['exceptionHandler'];
$TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionalErrors'] = $TYPO3_CONF_VARS['SYS']['exceptionalErrors'];
// Turn error logging on/off.
if (($displayErrors=intval($TYPO3_CONF_VARS['SYS']['displayErrors']))!='-1') {
if ($displayErrors==2) { // Special value "2" enables this feature only if $TYPO3_CONF_VARS[SYS][devIPmask] matches
if (t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
$displayErrors=1;
$TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler'] = 't3lib_error_DebugExceptionHandler';
} else {
$displayErrors=0;
}
}
if ($displayErrors == 0) {
$TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionalErrors'] = 0;
}
@ini_set('display_errors', $displayErrors);
} elseif (t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
// with displayErrors = -1 (default), turn on debugging if devIPmask matches:
$TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler'] = 't3lib_error_DebugExceptionHandler';
}
// Set PHP memory limit depending on value of $TYPO3_CONF_VARS["SYS"]["setMemoryLimit"]
t3lib/error/class.t3lib_error_abstractexceptionhandler.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* An abstract exception handler
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: AbstractExceptionHandler.php 3189 2009-09-16 13:36:22Z k-fish $
*/
abstract class t3lib_error_AbstractExceptionHandler implements t3lib_error_ExceptionHandlerInterface, t3lib_Singleton {
/**
* Displays the given exception
*
* @param Exception $exception The exception object
* @return void
*/
public function handleException(Exception $exception) {
switch (PHP_SAPI) {
case 'cli' :
$this->echoExceptionCLI($exception);
break;
default :
$this->echoExceptionWeb($exception);
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_abstractexceptionhandler.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_abstractexceptionhandler.php']);
}
?>
t3lib/error/class.t3lib_error_debugexceptionhandler.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* A basic but solid exception handler which catches everything which
* falls through the other exception handlers and provides useful debugging
* information.
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: DebugExceptionHandler.php 3195 2009-09-17 11:27:14Z k-fish $
*/
class t3lib_error_DebugExceptionHandler extends t3lib_error_AbstractExceptionHandler {
/**
* Constructs this exception handler - registers itself as the default exception handler.
*
* @author Robert Lemke <robert@typo3.org>
*/
public function __construct() {
set_exception_handler(array($this, 'handleException'));
}
/**
* Formats and echoes the exception as XHTML.
*
* @param Exception $exception The exception object
* @return void
* @author Robert Lemke <robert@typo3.org>
*/
public function echoExceptionWeb(Exception $exception) {
if (!headers_sent()) {
header("HTTP/1.1 500 Internal Server Error");
}
$filePathAndName = $exception->getFile();
$exceptionCodeNumber = ($exception->getCode() > 0) ? '#' . $exception->getCode() . ': ' : '';
/**
* TODO: 25.09.2009
* either remove this line or let the link point to site that offers error information for TYPO3
*/
// $moreInformationLink = ($exceptionCodeNumber != '') ? '(<a href="http://typo3.org/go/exception/' . $exception->getCode() . '">More information</a>)' : '';
$backtraceCode = $this->getBacktraceCode($exception->getTrace());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title>TYPO3 Exception</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style>
.ExceptionProperty {
color: #101010;
}
pre {
margin: 0;
font-size: 11px;
color: #515151;
background-color: #D0D0D0;
padding-left: 30px;
}
</style>
<div style="
position: absolute;
left: 10px;
background-color: #B9B9B9;
outline: 1px solid #515151;
color: #515151;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 10px;
padding: 0;
">
<div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Uncaught TYPO3 Exception</div>
<div style="width: 100%; padding: 2px; margin: 0 0 6px 0;">
<strong style="color: #BE0027;">' . $exceptionCodeNumber . $exception->getMessage() . '</strong> ' ./* $moreInformationLink .*/ '<br />
<br />
<span class="ExceptionProperty">' . get_class($exception) . '</span> thrown in file<br />
<span class="ExceptionProperty">' . $filePathAndName . '</span> in line
<span class="ExceptionProperty">' . $exception->getLine() . '</span>.<br />
<br />
' . $backtraceCode . '
</div>
';
echo '
</div>
';
}
/**
* Formats and echoes the exception for the command line
*
* @param Exception $exception The exception object
* @return void
* @author Robert Lemke <robert@typo3.org>
*/
public function echoExceptionCLI(Exception $exception) {
$filePathAndName = $exception->getFile();
$exceptionCodeNumber = ($exception->getCode() > 0) ? '#' . $exception->getCode() . ': ' : '';
echo "\nUncaught TYPO3 Exception " . $exceptionCodeNumber . $exception->getMessage() . "\n";
echo "thrown in file " . $filePathAndName . "\n";
echo "in line " . $exception->getLine() . "\n\n";
}
/**
* Renders some backtrace
*
* @param array $trace The trace
* @return string Backtrace information
* @author Robert Lemke <robert@typo3.org>
*/
protected function getBacktraceCode(array $trace) {
$backtraceCode = '';
if (count($trace)) {
foreach ($trace as $index => $step) {
$class = isset($step['class']) ? $step['class'] . '<span style="color:white;">::</span>' : '';
$arguments = '';
if (isset($step['args']) && is_array($step['args'])) {
foreach ($step['args'] as $argument) {
$arguments .= (strlen($arguments) === 0) ? '' : '<span style="color:white;">,</span> ';
if (is_object($argument)) {
$arguments .= '<span style="color:#FF8700;"><em>' . get_class($argument) . '</em></span>';
} elseif (is_string($argument)) {
$preparedArgument = (strlen($argument) < 100) ? $argument : substr($argument, 0, 50) . '…' . substr($argument, -50);
$preparedArgument = htmlspecialchars($preparedArgument);
$preparedArgument = str_replace("…", '<span style="color:white;">…</span>', $preparedArgument);
$preparedArgument = str_replace("\n", '<span style="color:white;">⏎</span>', $preparedArgument);
$arguments .= '"<span style="color:#FF8700;" title="' . htmlspecialchars($argument) . '">' . $preparedArgument . '</span>"';
} elseif (is_numeric($argument)) {
$arguments .= '<span style="color:#FF8700;">' . (string)$argument . '</span>';
} else {
$arguments .= '<span style="color:#FF8700;"><em>' . gettype($argument) . '</em></span>';
}
}
}
$backtraceCode .= '<pre style="color:#69A550; background-color: #414141; padding: 4px 2px 4px 2px;">';
$backtraceCode .= '<span style="color:white;">' . (count($trace) - $index) . '</span> ' . $class . $step['function'] . '<span style="color:white;">(' . $arguments . ')</span>';
$backtraceCode .= '</pre>';
if (isset($step['file'])) {
$backtraceCode .= $this->getCodeSnippet($step['file'], $step['line']) . '<br />';
}
}
}
return $backtraceCode;
}
/**
* Returns a code snippet from the specified file.
*
* @param string $filePathAndName Absolute path and file name of the PHP file
* @param integer $lineNumber Line number defining the center of the code snippet
* @return string The code snippet
* @author Robert Lemke <robert@typo3.org>
*/
protected function getCodeSnippet($filePathAndName, $lineNumber) {
$codeSnippet = '<br />';
if (@file_exists($filePathAndName)) {
$phpFile = @file($filePathAndName);
if (is_array($phpFile)) {
$startLine = ($lineNumber > 2) ? ($lineNumber - 2) : 1;
$endLine = ($lineNumber < (count($phpFile) - 2)) ? ($lineNumber + 3) : count($phpFile) + 1;
if ($endLine > $startLine) {
$codeSnippet = '<br /><span style="font-size:10px;">' . $filePathAndName . ':</span><br /><pre>';
for ($line = $startLine; $line < $endLine; $line++) {
$codeLine = str_replace("\t", ' ', $phpFile[$line-1]);
if ($line === $lineNumber) {
$codeSnippet .= '</pre><pre style="background-color: #F1F1F1; color: black;">';
}
$codeSnippet .= sprintf('%05d', $line) . ': ' . $codeLine;
if ($line === $lineNumber) {
$codeSnippet .= '</pre><pre>';
}
}
$codeSnippet .= '</pre>';
}
}
}
return $codeSnippet;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_debugexceptionhandler.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_debugexceptionhandler.php']);
}
?>
t3lib/error/class.t3lib_error_productionexceptionhandler.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* A quite exception handler which catches but ignores any exception.
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: ProductionExceptionHandler.php 3189 2009-09-16 13:36:22Z k-fish $
*/
class t3lib_error_ProductionExceptionHandler extends t3lib_error_AbstractExceptionHandler {
/**
* Constructs this exception handler - registers itself as the default exception handler.
*
* @author Robert Lemke <robert@typo3.org>
*/
public function __construct() {
set_exception_handler(array($this, 'handleException'));
}
/**
* Echoes an exception for the web.
*
* @param Exception $exception The exception
* @return void
*/
public function echoExceptionWeb(Exception $exception) {
if (!headers_sent()) {
header("HTTP/1.1 500 Internal Server Error");
}
t3lib_timeTrack::debug_typo3PrintError(get_class($exception), $exception->getMessage(), 0, t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
}
/**
* Echoes an exception for the command line.
*
* @param Exception $exception The exception
* @return void
*/
public function echoExceptionCLI(Exception $exception) {
exit(1);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_productionexceptionhandler.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_productionexceptionhandler.php']);
}
?>
t3lib/error/interface.t3lib_error_errorhandlerinterface.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Error handler interface for TYPO3
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: ErrorHandlerInterface.php 3195 2009-09-17 11:27:14Z k-fish $
*/
interface t3lib_error_ErrorHandlerInterface {
/**
* Defines which error levels result should result in an exception thrown.
* Registers this class as default error handler
*
* @param integer $exceptionalErrors The integer representing the E_* error level to handle as exceptions
* @return void
*/
public function setErrorHandlerForExceptionalErrors($exceptionalErrors);
/**
* Handles an error by converting it into an exception
*
* @param integer $errorLevel The error level - one of the E_* constants
* @param string $errorMessage The error message
* @param string $errorFile Name of the file the error occurred in
* @param integer $errorLine Line number where the error occurred
* @return void
* @throws t3lib_error_Exception with the data passed to this method
*/
public function handleError($errorLevel, $errorMessage, $errorFile, $errorLine);
}
?>
t3lib/error/class.t3lib_error_errorhandler.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Global error handler for TYPO3
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: ErrorHandler.php 3195 2009-09-17 11:27:14Z k-fish $
*/
class t3lib_error_ErrorHandler implements t3lib_error_ErrorHandlerInterface {
/**
* @var array
*/
protected $exceptionalErrors = array();
/**
* Defines which error levels result should result in an exception thrown.
* Registers this class as default error handler
*
* @param integer $exceptionalErrors The integer representing the E_* error level to handle as exceptions
* @return void
*/
public function setErrorHandlerForExceptionalErrors($exceptionalErrors) {
$this->exceptionalErrors = (int)$exceptionalErrors;
set_error_handler(array($this, 'handleError'), $this->exceptionalErrors);
}
/**
* Handles an error by converting it into an exception
*
* @param integer $errorLevel The error level - one of the E_* constants
* @param string $errorMessage The error message
* @param string $errorFile Name of the file the error occurred in
* @param integer $errorLine Line number where the error occurred
* @return void
* @throws t3lib_error_Exception with the data passed to this method
*/
public function handleError($errorLevel, $errorMessage, $errorFile, $errorLine) {
if (error_reporting()==0) { return TRUE; }
$errorLevels = array (
E_WARNING => 'Warning',
E_NOTICE => 'Notice',
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'
);
if ($errorLevel & $this->exceptionalErrors) {
throw new t3lib_error_Exception($errorLevels[$errorLevel] . ': ' . $errorMessage . ' in ' . $errorFile . ' line ' . $errorLine, 1);
}
// Don't execute PHP internal error handler
return TRUE;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_errorhandler.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_errorhandler.php']);
}
?>
t3lib/error/interface.t3lib_error_exceptionhandlerinterface.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Contract for an exception handler
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: t3lib_error_ExceptionHandlerInterface.php 2813 2009-07-16 14:02:34Z k-fish $
*/
interface t3lib_error_ExceptionHandlerInterface {
/**
* Constructs this exception handler - registers itself as the default exception handler.
*/
public function __construct();
/**
* Handles the given exception
*
* @param Exception $exception: The exception object
* @return void
*/
public function handleException(Exception $exception);
/**
* Formats and echoes the exception as XHTML.
*
* @param Exception $exception The exception object
* @return void
*/
public function echoExceptionWeb(Exception $exception);
/**
* Formats and echoes the exception for the command line
*
* @param Exception $exception The exception object
* @return void
*/
public function echoExceptionCLI(Exception $exception);
}
?>
t3lib/error/class.t3lib_error_exception.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 Ingo Renner <ingo@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* An exception which represents a PHP error.
*
* This file is a backport from FLOW3
*
* @package TYPO3
* @subpackage t3lib_error
* @version $Id: Exception.php 2813 2009-07-16 14:02:34Z k-fish $
*/
class t3lib_error_Exception extends t3lib_exception {
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_exception.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_exception.php']);
}
?>
t3lib/core_autoload.php (Arbeitskopie)
't3lib_db' => PATH_t3lib . 'class.t3lib_db.php',
't3lib_diff' => PATH_t3lib . 'class.t3lib_diff.php',
't3lib_div' => PATH_t3lib . 'class.t3lib_div.php',
't3lib_exception' => PATH_t3lib . 'class.t3lib_exception.php',
't3lib_exec' => PATH_t3lib . 'class.t3lib_exec.php',
't3lib_extfilefunctions' => PATH_t3lib . 'class.t3lib_extfilefunc.php',
't3lib_extmgm' => PATH_t3lib . 'class.t3lib_extmgm.php',
......
't3lib_cache_frontend_stringfrontend' => PATH_t3lib . 'cache/frontend/class.t3lib_cache_frontend_stringfrontend.php',
't3lib_cache_frontend_variablefrontend' => PATH_t3lib . 'cache/frontend/class.t3lib_cache_frontend_variablefrontend.php',
't3lib_cache_frontend_frontend' => PATH_t3lib . 'cache/frontend/interfaces/interface.t3lib_cache_frontend_frontend.php',
't3lib_error_abstractexceptionhandler' => PATH_t3lib . 'error/class.t3lib_error_abstractexceptionhandler.php',
't3lib_error_debugexceptionhandler' => PATH_t3lib . 'error/class.t3lib_error_debugexceptionhandler.php',
't3lib_error_error' => PATH_t3lib . 'error/class.t3lib_error_error.php',
't3lib_error_errorhandler' => PATH_t3lib . 'error/class.t3lib_error_errorhandler.php',
't3lib_error_exception' => PATH_t3lib . 'error/class.t3lib_error_exception.php',
't3lib_error_errorhandlerinterface' => PATH_t3lib . 'error/interface.t3lib_error_errorhandlerinterface.php',
't3lib_error_exceptionhandlerinterface' => PATH_t3lib . 'error/interface.t3lib_error_exceptionhandlerinterface.php',
't3lib_error_productionexceptionhandler' => PATH_t3lib . 'error/class.t3lib_error_productionexceptionhandler.php',
't3lib_error_warning' => PATH_t3lib . 'error/class.t3lib_error_warning.php',
't3lib_browselinkshook' => PATH_t3lib . 'interfaces/interface.t3lib_browselinkshook.php',
't3lib_localrecordlistgettablehook' => PATH_t3lib . 'interfaces/interface.t3lib_localrecordlistgettablehook.php',
't3lib_singleton' => PATH_t3lib . 'interfaces/interface.t3lib_singleton.php',
typo3/init.php (Arbeitskopie)
t3lib_autoloader::registerAutoloader();
// *********************
// Error & Exception handling
// *********************
if ($TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler'] !== '') {
$errorHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SYS']['errorHandler']);
// register an error handler for the given exceptionalErrors
$errorHandler->setErrorHandlerForExceptionalErrors($TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionalErrors']);
$exceptionHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler']);
}
/** @var TYPO3_DB t3lib_db */
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
typo3/sysext/cms/tslib/index_ts.php (Arbeitskopie)
$TT->pull();
// *********************
// Error & Exception handling
// *********************
if ($TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler'] !== '') {
$TT->push('Register Exceptionhandler', '');
$errorHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SYS']['errorHandler']);
// register an error handler for the given exceptionalErrors
$errorHandler->setErrorHandlerForExceptionalErrors($TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionalErrors']);
$exceptionHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SC_OPTIONS']['errors']['exceptionHandler']);
$TT->pull();
}
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
(4-4/4)