Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
f72c451c
Commit
f72c451c
authored
Aug 02, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display debug toolbar on error pages.
parent
1398de3f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
30 deletions
+37
-30
Application.php
framework/yii/base/Application.php
+2
-1
ErrorHandler.php
framework/yii/base/ErrorHandler.php
+10
-5
callStackItem.php
framework/yii/views/errorHandler/callStackItem.php
+5
-5
error.php
framework/yii/views/errorHandler/error.php
+14
-13
exception.php
framework/yii/views/errorHandler/exception.php
+0
-0
previousException.php
framework/yii/views/errorHandler/previousException.php
+6
-6
No files found.
framework/yii/base/Application.php
View file @
f72c451c
...
...
@@ -475,6 +475,8 @@ abstract class Application extends Module
*/
public
function
handleFatalError
()
{
unset
(
$this
->
_memoryReserve
);
// load ErrorException manually here because autoloading them will not work
// when error occurs while autoloading a class
if
(
!
class_exists
(
'\\yii\\base\\Exception'
,
false
))
{
...
...
@@ -487,7 +489,6 @@ abstract class Application extends Module
$error
=
error_get_last
();
if
(
ErrorException
::
isFatalError
(
$error
))
{
unset
(
$this
->
_memoryReserve
);
$exception
=
new
ErrorException
(
$error
[
'message'
],
$error
[
'type'
],
$error
[
'type'
],
$error
[
'file'
],
$error
[
'line'
]);
// use error_log because it's too late to use Yii log
error_log
(
$exception
);
...
...
framework/yii/base/ErrorHandler.php
View file @
f72c451c
...
...
@@ -192,11 +192,16 @@ class ErrorHandler extends Component
*/
public
function
renderFile
(
$_file_
,
$_params_
)
{
ob_start
();
ob_implicit_flush
(
false
);
extract
(
$_params_
,
EXTR_OVERWRITE
);
require
(
Yii
::
getAlias
(
$_file_
));
return
ob_get_clean
();
$_params_
[
'handler'
]
=
$this
;
if
(
$this
->
exception
instanceof
ErrorException
)
{
ob_start
();
ob_implicit_flush
(
false
);
extract
(
$_params_
,
EXTR_OVERWRITE
);
require
(
Yii
::
getAlias
(
$_file_
));
return
ob_get_clean
();
}
else
{
return
Yii
::
$app
->
getView
()
->
renderFile
(
$_file_
,
$_params_
,
$this
);
}
}
/**
...
...
framework/yii/views/errorHandler/callStackItem.php
View file @
f72c451c
...
...
@@ -8,19 +8,19 @@
* @var string[] $lines
* @var integer $begin
* @var integer $end
* @var \yii\base\ErrorHandler $
this
* @var \yii\base\ErrorHandler $
handler
*/
?>
<li
class=
"
<?php
if
(
!
$
this
->
isCoreFile
(
$file
)
||
$index
===
1
)
echo
'application'
;
?>
call-stack-item"
<li
class=
"
<?php
if
(
!
$
handler
->
isCoreFile
(
$file
)
||
$index
===
1
)
echo
'application'
;
?>
call-stack-item"
data-line=
"
<?php
echo
(
int
)(
$line
-
$begin
);
?>
"
>
<div
class=
"element-wrap"
>
<div
class=
"element"
>
<span
class=
"item-number"
>
<?php
echo
(
int
)
$index
;
?>
.
</span>
<span
class=
"text"
>
<?php
if
(
$file
!==
null
)
echo
'in '
.
$
this
->
htmlEncode
(
$file
);
?>
</span>
<span
class=
"text"
>
<?php
if
(
$file
!==
null
)
echo
'in '
.
$
handler
->
htmlEncode
(
$file
);
?>
</span>
<?php
if
(
$method
!==
null
)
:
?>
<span
class=
"call"
>
<?php
if
(
$file
!==
null
)
echo
'–'
?>
<?php
if
(
$class
!==
null
)
echo
$
this
->
addTypeLinks
(
$class
)
.
'::'
;
?><?php
echo
$this
->
addTypeLinks
(
$method
.
'()'
);
?>
<?php
if
(
$class
!==
null
)
echo
$
handler
->
addTypeLinks
(
$class
)
.
'::'
;
?><?php
echo
$handler
->
addTypeLinks
(
$method
.
'()'
);
?>
</span>
<?php
endif
;
?>
<span
class=
"at"
>
<?php
if
(
$line
!==
null
)
echo
'at line'
;
?>
</span>
...
...
@@ -36,7 +36,7 @@
<pre>
<?php
// fill empty lines with a whitespace to avoid rendering problems in opera
for
(
$i
=
$begin
;
$i
<=
$end
;
++
$i
)
{
echo
(
trim
(
$lines
[
$i
])
==
''
)
?
"
\n
"
:
$
this
->
htmlEncode
(
$lines
[
$i
]);
echo
(
trim
(
$lines
[
$i
])
==
''
)
?
"
\n
"
:
$
handler
->
htmlEncode
(
$lines
[
$i
]);
}
?>
</pre>
</div>
...
...
framework/yii/views/errorHandler/error.php
View file @
f72c451c
<?php
/**
* @var \Exception $exception
* @var \yii\base\ErrorHandler $
this
* @var \yii\base\ErrorHandler $
handler
*/
$title
=
$
this
->
htmlEncode
(
$exception
instanceof
\yii\base\Exception
?
$exception
->
getName
()
:
get_class
(
$exception
));
$title
=
$
handler
->
htmlEncode
(
$exception
instanceof
\yii\base\Exception
?
$exception
->
getName
()
:
get_class
(
$exception
));
?>
<!DOCTYPE html>
<html>
...
...
@@ -50,16 +50,17 @@ $title = $this->htmlEncode($exception instanceof \yii\base\Exception ? $exceptio
</head>
<body>
<h1>
<?php
echo
$title
?>
</h1>
<h2>
<?php
echo
nl2br
(
$this
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h2>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
<div
class=
"version"
>
<?php
echo
date
(
'Y-m-d H:i:s'
,
time
())
?>
</div>
<h1>
<?php
echo
$title
?>
</h1>
<h2>
<?php
echo
nl2br
(
$handler
->
htmlEncode
(
$exception
->
getMessage
()))
?>
</h2>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
<div
class=
"version"
>
<?php
echo
date
(
'Y-m-d H:i:s'
,
time
())
?>
</div>
<?php
if
(
method_exists
(
$this
,
'endBody'
))
$this
->
endBody
();
// to allow injecting code into body (mostly by Yii Debug Toolbar) ?>
</
body
>
</
html
>
framework/yii/views/errorHandler/exception.php
View file @
f72c451c
This diff is collapsed.
Click to expand it.
framework/yii/views/errorHandler/previousException.php
View file @
f72c451c
<?php
/**
* @var \yii\base\Exception $exception
* @var \yii\base\ErrorHandler $
this
* @var \yii\base\ErrorHandler $
handler
*/
?>
<div
class=
"previous"
>
...
...
@@ -9,13 +9,13 @@
<h2>
<span>
Caused by:
</span>
<?php
if
(
$exception
instanceof
\yii\base\Exception
)
:
?>
<span>
<?php
echo
$
this
->
htmlEncode
(
$exception
->
getName
());
?>
</span>
–
<?php
echo
$
this
->
addTypeLinks
(
get_class
(
$exception
));
?>
<span>
<?php
echo
$
handler
->
htmlEncode
(
$exception
->
getName
());
?>
</span>
–
<?php
echo
$
handler
->
addTypeLinks
(
get_class
(
$exception
));
?>
<?php
else
:
?>
<span>
<?php
echo
$
this
->
htmlEncode
(
get_class
(
$exception
));
?>
</span>
<span>
<?php
echo
$
handler
->
htmlEncode
(
get_class
(
$exception
));
?>
</span>
<?php
endif
;
?>
</h2>
<h3>
<?php
echo
$
this
->
htmlEncode
(
$exception
->
getMessage
());
?>
</h3>
<h3>
<?php
echo
$
handler
->
htmlEncode
(
$exception
->
getMessage
());
?>
</h3>
<p>
in
<span
class=
"file"
>
<?php
echo
$exception
->
getFile
();
?>
</span>
at line
<span
class=
"line"
>
<?php
echo
$exception
->
getLine
();
?>
</span></p>
<?php
echo
$
this
->
renderPreviousExceptions
(
$exception
);
?>
<?php
echo
$
handler
->
renderPreviousExceptions
(
$exception
);
?>
</div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment