1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<style>
html{
width:100%;
min-height:100%;
font-family:'Verdana';
font-size:14px;
}
body{
min-height:100%;
background: #a90329; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, #a90329 0%, #6d0019 100%); /* FF3.6+ */
background: -webkit-radial-gradient(center, ellipse cover, #a90329 0%,#6d0019 100%); /* Chrome10+,Safari5.1+ */
}
#content{
width:1000px;
margin:auto;
padding:10px 0px;
background:#eee;
}
.file{
font-weight:bold;
}
.block{
border-bottom:1px solid #000;
margin:10px;
}
.code{
padding:10px;
}
.highlight{
background:#efecd0;
}
#exception{
font-size:25px;
font-weight:bold;
padding:10px;
}
#debug{
border-bottom: 1px solid black;
margin: 10px;
}
#log{
font-size:15px;
font-weight:bold;
padding:5px;
}
.log{
padding:10px;
border-bottom: 1px solid black;
}
.log.odd{
}
pre{
margin:0px;
}
.thick{
border-width:2px;
}
</style>
</head>
<body>
<?php
$rawblocks=array_merge(array(array(
'file'=>$exception->getFile(),
'line'=>$exception->getLine()
)), $exception->getTrace());
$blocks = array();
foreach($rawblocks as $block){
if(!isset($block['file']))
continue;
//avoid duplicates
if(count($blocks)>0){
$last=$blocks[count($blocks)-1];
if($block['file']==$last['file'] && $block['line']==$last['line'])
continue;
}
$blocks[]=$block;
}
?>
<div id="content">
<div id="exception"><?php echo str_replace("\n",'<br/>',$exception->getMessage()); ?></div>
<div id="blocks">
<?php foreach($blocks as $bkey=>$block): ?>
<div class="block <?php echo (!empty($log)&&$bkey==0)?'thick':''; ?>">
<div class="file"><?php echo $block['file'];?></div>
<div class="code">
<?php
$line=$block['line']-1;
$code = explode("\n", file_get_contents($block['file']));
$start = $line - 3;
if ($start < 0) $start = 0;
$end = $line + 3;
if($end>=count($code)) $end=count($code)-1;
$code=array_slice($code,$start,$end-$start,true);
?>
<?php foreach($code as $n=>$text):?>
<pre class="line <?php echo $n==$line?'highlight':''; ?>"><?php echo ($n+1).' '.htmlspecialchars($text); ?></pre>
<?php endforeach;?>
</div>
</div>
<?php if($bkey==0&&!empty($log)):?>
<div id="debug">
<div id="log">Logged values:</div>
<?php foreach($log as $key=>$val):?>
<div class="log <?php echo $key%2?'odd':''; ?>">
<pre><?php var_export($val);?></pre>
</div>
<?php endforeach;?>
</div>
<div id="log">Call stack:</div>
<?php endif;?>
<?php endforeach;?>
</div>
</div>
</body>
</html>
|