Feature #19336 » 9355_v1.diff
t3lib/config_default.php (working copy) | ||
---|---|---|
You need to have memcached installed as a daemon and also as a PHP extension!
|
||
*/
|
||
)
|
||
),
|
||
'exceptionHandler' => 't3lib_error_ProductionExceptionHandler',
|
||
'errorHandler' => 't3lib_error_ErrorHandler',
|
||
'exceptionalErrors' => array (
|
||
0 => '1',
|
||
1 => '4',
|
||
2 => '16',
|
||
3 => '64',
|
||
4 => '256',
|
||
5 => '4096',
|
||
)
|
||
),
|
||
'EXT' => Array ( // Options related to the Extension Management
|
||
... | ... | |
@ini_set('display_errors', $displayErrors);
|
||
}
|
||
// Error & Exceptionhandling
|
||
if ($displayErrors == 1) {
|
||
$TYPO3_CONF_VARS['SYS']['exceptionHandler'] = 't3lib_error_DebugExceptionHandler';
|
||
}
|
||
// Set PHP memory limit depending on value of $TYPO3_CONF_VARS["SYS"]["setMemoryLimit"]
|
||
if(intval($TYPO3_CONF_VARS["SYS"]["setMemoryLimit"])>16) {
|
||
@ini_set('memory_limit',intval($TYPO3_CONF_VARS["SYS"]["setMemoryLimit"]).'m');
|
t3lib/core_autoload.php (working copy) | ||
---|---|---|
'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_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',
|
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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: AbstractExceptionHandler.php 2813 2009-07-16 14:02:34Z k-fish $
|
||
*/
|
||
abstract class t3lib_error_AbstractExceptionHandler implements t3lib_error_ExceptionHandlerInterface, t3lib_Singleton {
|
||
/**
|
||
* @var t3lib_log_SystemLoggerInterface
|
||
*/
|
||
protected $systemLogger;
|
||
/**
|
||
* @var t3lib_core_LockManager
|
||
*/
|
||
protected $lockManager;
|
||
/**
|
||
* Injects the system logger
|
||
*
|
||
* @param t3lib_log_SystemLoggerInterface $systemLogger
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function injectSystemLogger(t3lib_log_SystemLoggerInterface $systemLogger) {
|
||
$this->systemLogger = $systemLogger;
|
||
}
|
||
/**
|
||
* Injects the Lock Manager
|
||
*
|
||
* @param t3lib_core_LockManager $lockManager
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function injectLockManager(t3lib_core_LockManager $lockManager) {
|
||
$this->lockManager = $lockManager;
|
||
}
|
||
/**
|
||
* 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/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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: DebugExceptionHandler.php 2850 2009-07-22 13:09:17Z robert $
|
||
*/
|
||
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_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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: Error.php 2813 2009-07-16 14:02:34Z 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_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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: ErrorHandler.php 2813 2009-07-16 14:02:34Z k-fish $
|
||
*/
|
||
class t3lib_error_ErrorHandler implements t3lib_Singleton {
|
||
/**
|
||
* @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() {
|
||
set_error_handler(array($this, 'handleError'));
|
||
}
|
||
/**
|
||
* Defines which error levels result should result in an exception thrown.
|
||
*
|
||
* @param array $exceptionalErros An array of E_* error levels
|
||
* @return void
|
||
* @author Robert Lemke <robert@typo3.org>
|
||
*/
|
||
public function setExceptionalErrors(array $exceptionalErrors) {
|
||
$this->exceptionalErrors = $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_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_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 (in_array($errorLevel, (array)$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/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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: Exception.php 2813 2009-07-16 14:02:34Z k-fish $
|
||
*/
|
||
class t3lib_error_Exception extends 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/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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: ProductionExceptionHandler.php 2813 2009-07-16 14:02:34Z 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");
|
||
}
|
||
$exceptionCodeNumber = ($exception->getCode() > 0) ? '#' . $exception->getCode() . ': ' : '';
|
||
$moreInformationLink = ($exceptionCodeNumber != '') ? '<p><em><a href="http://typo3.org/go/exception/' . $exception->getCode() . '">More information</a></em></p>' : '';
|
||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html>
|
||
<head>
|
||
<style type="text/css">
|
||
body {
|
||
font-family: Helvetica, Arial, sans-serif;
|
||
margin: 0;
|
||
}
|
||
h1 {
|
||
font-size: 15px;
|
||
}
|
||
.F3_WidgetLibrary_Widgets_ApplicationWindow {
|
||
position: absolute;
|
||
width: 100%;
|
||
height: 100%;
|
||
background-color: #fff;
|
||
margin: 0;
|
||
z-index: 1000;
|
||
}
|
||
.F3_WidgetLibrary_Widgets_FloatingWindow {
|
||
width: 500px;
|
||
height: 360px;
|
||
border: 1px solid #515151;
|
||
margin: auto;
|
||
margin-top: 150px;
|
||
}
|
||
.F3_WidgetLibrary_Widgets_FloatingWindow .F3_WidgetLibrary_Widgets_Window_TitleBar {
|
||
font-size: 13px;
|
||
position: relative;
|
||
padding: 25px 0 0 26px;
|
||
width: 440px;
|
||
text-align: center;
|
||
color: #404040;
|
||
}
|
||
.F3_WidgetLibrary_Widgets_FloatingWindow .F3_WidgetLibrary_Widgets_Window_Body {
|
||
font-size: 14px;
|
||
position: relative;
|
||
padding: 30px 0 0 50px;
|
||
width: 400px;
|
||
text-align: left;
|
||
color: #202020;
|
||
line-height: 18px;
|
||
}
|
||
.StandardView_Package {
|
||
width: 70px;
|
||
float: right;
|
||
margin: 0 0 80px 10px;
|
||
}
|
||
</style>
|
||
<!--[if lte IE 7]>
|
||
<style type="text/css">
|
||
.F3_WidgetLibrary_Widgets_FloatingWindow {
|
||
background-color: #ccc;
|
||
background-image: none;
|
||
}
|
||
.F3_WidgetLibrary_Widgets_Window_TitleBar {
|
||
background-color:#aaa;
|
||
font-weight:bold;
|
||
}
|
||
.StandardView_Package {
|
||
display:none;
|
||
}
|
||
</style>
|
||
<![endif]-->
|
||
</head>
|
||
<body>
|
||
<div class="F3_WidgetLibrary_Widgets_ApplicationWindow">
|
||
<div class="F3_WidgetLibrary_Widgets_FloatingWindow">
|
||
<div class="F3_WidgetLibrary_Widgets_Window_TitleBar">500 Internal Server Error</div>
|
||
<div class="F3_WidgetLibrary_Widgets_Window_Body">
|
||
<h1>500 Internal Server Error</h1>
|
||
<p>The system experienced an internal error (uncaught exception):</p>
|
||
<p>' . get_class($exception) . '</p>
|
||
' . $moreInformationLink . '
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>';
|
||
}
|
||
/**
|
||
* 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 TYPO3
|
||
*
|
||
* @package TYPO3
|
||
* @subpackage t3lib_error
|
||
* @version $Id: Warning.php 2813 2009-07-16 14:02:34Z 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/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 TYPO3
|
||
*
|
||
* @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);
|
||
}
|
||
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/interface.t3lib_error_exceptionhandlerinterface.php']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/error/interface.t3lib_error_exceptionhandlerinterface.php']);
|
||
}
|
||
?>
|
typo3/sysext/cms/tslib/index_ts.php (working copy) | ||
---|---|---|
$TT->pull();
|
||
// *********************
|
||
// Error & Exception handling
|
||
// *********************
|
||
$TT->push('Register Exceptionhandler', '');
|
||
$errorHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SYS']['errorHandler']);
|
||
$errorHandler->setExceptionalErrors($TYPO3_CONF_VARS['SYS']['exceptionalErrors']);
|
||
$exceptionHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SYS']['exceptionHandler']);
|
||
$TT->pull();
|
||
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
|
||
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
|
||
typo3/init.php (working copy) | ||
---|---|---|
t3lib_autoloader::registerAutoloader();
|
||
// *********************
|
||
// Error & Exception handling
|
||
// *********************
|
||
$errorHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SYS']['errorHandler']);
|
||
$errorHandler->setExceptionalErrors($TYPO3_CONF_VARS['SYS']['exceptionalErrors']);
|
||
$exceptionHandler = t3lib_div::makeInstance($TYPO3_CONF_VARS['SYS']['exceptionHandler']);
|
||
/** @var TYPO3_DB t3lib_db */
|
||
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
|
||
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
|