Feature #19336 » 9355v4.diff
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) | ||
---|---|---|
)
|
||
),
|
||
'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.
|
||
'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|E_WARNING), // Integer: The E_* constant that will be handled as an exception by t3lib_error_ErrorHandler. Default is E_ALL&~(E_NOTICE|E_WARNING) and "0" if displayError=0. 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);
|
||
} else if (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']['exceptionalErrors'] = E_ALL&~E_NOTICE;
|
||
$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 {
|
||
/**
|
||
* Handles the given exception
|
||
*
|
||
* @param Exception $exception The exception object
|
||
* @return void
|
||
*/
|
||
public function handleException(Exception $exception) {
|
||
$exceptionCodeNumber = ($exception->getCode() > 0) ? ' #' . $exception->getCode() : '';
|
||
$backTrace = $exception->getTrace();
|
||
$className = isset($backTrace[0]['class']) ? $backTrace[0]['class'] : '?';
|
||
$methodName = isset($backTrace[0]['function']) ? $backTrace[0]['function'] : '?';
|
||
$line = isset($backTrace['line']) ? ' in line ' . $backTrace['line'] : '';
|
||
$message = 'Uncaught exception' . $exceptionCodeNumber . '. ' . $exception->getMessage() . $line . '.';
|
||
$explodedClassName = explode('\\', $className);
|
||
$packageKey = (isset($explodedClassName[1])) ? $explodedClassName[1] : NULL;
|
||
}
|
||
}
|
||
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/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 {
|
||
/**
|
||
* Constructs this error handler - registers itself as the default error handler.
|
||
*/
|
||
public function __construct();
|
||
/**
|
||
* Defines which error levels result should result in an exception thrown.
|
||
*
|
||
* @param integer $exceptionalErrors The integer representing the E_* error level to handle as exceptions
|
||
* @return void
|
||
*/
|
||
public function setExceptionalErrors($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_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'));
|
||
}
|
||
/**
|
||
* Displays the given exception
|
||
*
|
||
* @param Exception $exception The exception object
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function handleException(Exception $exception) {
|
||
parent::handleException($exception);
|
||
switch (PHP_SAPI) {
|
||
case 'cli' :
|
||
$this->echoExceptionCLI($exception);
|
||
break;
|
||
default :
|
||
$this->echoExceptionWeb($exception);
|
||
}
|
||
}
|
||
/**
|
||
* Formats and echoes the exception as XHTML.
|
||
*
|
||
* @param Exception $exception The exception object
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
protected function echoExceptionWeb(Exception $exception) {
|
||
if (!headers_sent()) {
|
||
header("HTTP/1.1 500 Internal Server Error");
|
||
}
|
||
$pathPosition = strpos($exception->getFile(), 'Packages/');
|
||
$filePathAndName = ($pathPosition === FALSE) ? substr($exception->getFile(), $pathPosition) : $exception->getFile();
|
||
$exceptionCodeNumber = ($exception->getCode() > 0) ? '#' . $exception->getCode() . ': ' : '';
|
||
$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>
|
||
*/
|
||
protected function echoExceptionCLI(Exception $exception) {
|
||
$pathPosition = strpos($exception->getFile(), 'Packages/');
|
||
$filePathAndName = ($pathPosition === FALSE) ? substr($exception->getFile(), $pathPosition) : $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'));
|
||
}
|
||
/**
|
||
* Displays the given exception
|
||
*
|
||
* @param Exception $exception The exception object
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function handleException(Exception $exception) {
|
||
parent::handleException($exception);
|
||
switch (PHP_SAPI) {
|
||
case 'cli' :
|
||
$this->echoExceptionCLI($exception);
|
||
break;
|
||
default :
|
||
$this->echoExceptionWeb($exception);
|
||
}
|
||
}
|
||
/**
|
||
* 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/class.t3lib_error_warning.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 object representation of a generic warning. Subclass this to create
|
||
* more specific warnings if necessary.
|
||
*
|
||
* This file is a backport from FLOW3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: Warning.php 3189 2009-09-16 13:36:22Z k-fish $
|
||
*/
|
||
class t3lib_error_Warning {
|
||
/**
|
||
* @var string The default (english) error message.
|
||
*/
|
||
protected $message = 'Unknown warning';
|
||
/**
|
||
* @var string The error code
|
||
*/
|
||
protected $code;
|
||
/**
|
||
* Constructs this warning
|
||
*
|
||
* @param string $message An english error message which is used if no other error message can be resolved
|
||
* @param integer $code A unique error code
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
* @api
|
||
*/
|
||
public function __construct($message, $code) {
|
||
$this->message = $message;
|
||
$this->code = 0;
|
||
}
|
||
/**
|
||
* Returns the error message
|
||
* @return string The error message
|
||
* @author Andreas Förthner <andreas.foerthner@netlogix.de>
|
||
* @api
|
||
*/
|
||
public function getMessage() {
|
||
return $this->message;
|
||
}
|
||
/**
|
||
* Returns the error code
|
||
* @return string The error code
|
||
* @author Andreas Förthner <andreas.foerthner@netlogix.de>
|
||
* @api
|
||
*/
|
||
public function getCode() {
|
||
return $this->code;
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_warning.php']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_warning.php']);
|
||
}
|
||
?>
|
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();
|
||
/**
|
||
* Constructs this error handler - registers itself as the default error handler.
|
||
*
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function __construct() {
|
||
}
|
||
/**
|
||
* Defines which error levels result should result in an exception thrown.
|
||
*
|
||
* @param integer $exceptionalErrors The integer representing the E_* error level to handle as exceptions
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function setExceptionalErrors($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
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function handleError($errorLevel, $errorMessage, $errorFile, $errorLine) {
|
||
$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);
|
||
}
|
||
}
|
||
}
|
||
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);
|
||
}
|
||
?>
|
t3lib/error/class.t3lib_error_error.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 object representation of a generic error. Subclass this to create
|
||
* more specific errors if necessary.
|
||
*
|
||
* This file is a backport from FLOW3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: Error.php 3189 2009-09-16 13:36:22Z k-fish $
|
||
*/
|
||
class t3lib_error_Error {
|
||
/**
|
||
* @var string The default (english) error message.
|
||
*/
|
||
protected $message = 'Unknown error';
|
||
/**
|
||
* @var string The error code
|
||
*/
|
||
protected $code;
|
||
/**
|
||
* Constructs this error
|
||
*
|
||
* @param string $message An english error message which is used if no other error message can be resolved
|
||
* @param integer $code A unique error code
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
* @api
|
||
*/
|
||
public function __construct($message, $code) {
|
||
$this->message = $message;
|
||
$this->code = $code;
|
||
}
|
||
/**
|
||
* Returns the error message
|
||
* @return string The error message
|
||
* @author Andreas Förthner <andreas.foerthner@netlogix.de>
|
||
* @api
|
||
*/
|
||
public function getMessage() {
|
||
return $this->message;
|
||
}
|
||
/**
|
||
* Returns the error code
|
||
* @return string The error code
|
||
* @author Andreas Förthner <andreas.foerthner@netlogix.de>
|
||
* @api
|
||
*/
|
||
public function getCode() {
|
||
return $this->code;
|
||
}
|
||
/**
|
||
* Converts this error into a string
|
||
*
|
||
* @return string
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
* @api
|
||
*/
|
||
public function __toString() {
|
||
return $this->message . ' (#' . $this->code . ')';
|
||
}
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_error.php']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/class.t3lib_error_error.php']);
|
||
}
|
||
?>
|
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']);
|
||
$errorHandler->setExceptionalErrors($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']);
|
||
$errorHandler->setExceptionalErrors($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'];
|
||