33 set_exception_handler(array($this,
'handleException'));
45 $filePathAndName = $exception->getFile();
46 $exceptionCodeNumber = $exception->getCode() > 0 ?
'#' . $exception->getCode() .
': ' :
'';
47 $moreInformationLink = $exceptionCodeNumber !==
'' 48 ?
'(<a href="' . TYPO3_URL_EXCEPTION .
'debug/' . $exception->getCode() .
'" target="_blank">More information</a>)' 53 $xmlPrologue =
'<?xml version="1.0" encoding="utf-8"?>';
55 $docType =
'<!DOCTYPE html 56 PUBLIC "-//W3C//DTD XHTML 1.1//EN" 57 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
63 if ($browserInfo[
'browser'] ===
'msie' && $browserInfo[
'version'] < 7) {
64 $headerStart = $docType . LF . $xmlPrologue;
66 $headerStart = $xmlPrologue . LF . $docType;
69 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 71 <title>TYPO3 Exception</title> 72 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 73 <style type="text/css"> 81 background-color: #D0D0D0; 90 background-color: #B9B9B9; 91 outline: 1px solid #515151; 93 font-family: Arial, Helvetica, sans-serif; 98 <div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Uncaught TYPO3 Exception</div> 99 <div style="width: 100%; padding: 2px; margin: 0 0 6px 0;"> 100 <strong style="color: #BE0027;">' . $exceptionCodeNumber . htmlspecialchars($exception->getMessage()) .
'</strong> ' . $moreInformationLink .
'<br /> 102 <span class="ExceptionProperty">' . get_class($exception) .
'</span> thrown in file<br /> 103 <span class="ExceptionProperty">' . htmlspecialchars($filePathAndName) .
'</span> in line 104 <span class="ExceptionProperty">' . $exception->getLine() .
'</span>.<br /> 106 ' . $backtraceCode .
' 122 $filePathAndName = $exception->getFile();
123 $exceptionCodeNumber = $exception->getCode() > 0 ?
'#' . $exception->getCode() .
': ' :
'';
126 Uncaught TYPO3 Exception ' . $exceptionCodeNumber . $exception->getMessage() . LF;
127 echo
'thrown in file ' . $filePathAndName . LF;
128 echo
'in line ' . $exception->getLine() .
' 144 foreach ($trace as $index => $step) {
145 $class = isset($step[
'class']) ? htmlspecialchars($step[
'class']) .
'<span style="color:white;">::</span>' :
'';
147 if (isset($step[
'args']) && is_array($step[
'args'])) {
148 foreach ($step[
'args'] as $argument) {
149 $arguments .= strlen($arguments) === 0 ?
'' :
'<span style="color:white;">,</span> ';
150 if (is_object($argument)) {
151 $arguments .=
'<span style="color:#FF8700;"><em>' . htmlspecialchars(get_class($argument)) .
'</em></span>';
152 } elseif (is_string($argument)) {
153 $preparedArgument = strlen($argument) < 100
155 : substr($argument, 0, 50) .
'#tripleDot#' . substr($argument, -50);
156 $preparedArgument = str_replace(
161 '<span style="color:white;">…</span>',
162 '<span style="color:white;">↵</span>' 164 htmlspecialchars($preparedArgument)
166 $arguments .=
'"<span style="color:#FF8700;" title="' . htmlspecialchars($argument) .
'">' 167 . $preparedArgument .
'</span>"';
168 } elseif (is_numeric($argument)) {
169 $arguments .=
'<span style="color:#FF8700;">' . (string) $argument .
'</span>';
171 $arguments .=
'<span style="color:#FF8700;"><em>' . gettype($argument) .
'</em></span>';
175 $backtraceCode .=
'<pre style="color:#69A550; background-color: #414141; padding: 4px 2px 4px 2px;">';
176 $backtraceCode .=
'<span style="color:white;">' . (count($trace) - $index) .
'</span> ' . $class
177 . $step[
'function'] .
'<span style="color:white;">(' . $arguments .
')</span>';
178 $backtraceCode .=
'</pre>';
179 if (isset($step[
'file'])) {
180 $backtraceCode .= $this->
getCodeSnippet($step[
'file'], $step[
'line']) .
'<br />';
184 return $backtraceCode;
196 $codeSnippet =
'<br />';
197 if (@file_exists($filePathAndName)) {
198 $phpFile = @file($filePathAndName);
199 if (is_array($phpFile)) {
200 $startLine = $lineNumber > 2 ? $lineNumber - 2 : 1;
201 $endLine = $lineNumber < count($phpFile) - 2 ? $lineNumber + 3 : count($phpFile) + 1;
202 if ($endLine > $startLine) {
203 $codeSnippet =
'<br /><span style="font-size:10px;">' . htmlspecialchars($filePathAndName) .
':</span><br /><pre>';
204 for ($line = $startLine; $line < $endLine; $line++) {
205 $codeLine = str_replace(TAB,
' ', $phpFile[$line - 1]);
206 if ($line === $lineNumber) {
207 $codeSnippet .=
'</pre><pre style="background-color: #F1F1F1; color: black;">';
209 $codeSnippet .= sprintf(
'%05d', $line) .
': ' . htmlspecialchars($codeLine);
210 if ($line === $lineNumber) {
211 $codeSnippet .=
'</pre><pre>';
214 $codeSnippet .=
'</pre>';
getCodeSnippet($filePathAndName, $lineNumber)
echoExceptionCLI(\Exception $exception)
static getBrowserInfo($userAgent)
sendStatusHeaders(\Exception $exception)
static getIndpEnv($getEnvName)
echoExceptionWeb(\Exception $exception)
writeLogEntries(\Exception $exception, $context)
getBacktraceCode(array $trace)