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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
12e5f62c
Commit
12e5f62c
authored
Jun 14, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Errorhandler, manually load classes
load ErrorException manually because autoloading them will not work when error occurs while autoloading a class
parent
42063744
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
Application.php
framework/yii/base/Application.php
+18
-2
No files found.
framework/yii/base/Application.php
View file @
12e5f62c
...
...
@@ -347,8 +347,7 @@ abstract class Application extends Module
/**
* Handles uncaught PHP exceptions.
*
* This method is implemented as a PHP exception handler. It requires
* that constant YII_ENABLE_ERROR_HANDLER be defined true.
* This method is implemented as a PHP exception handler.
*
* @param \Exception $exception the exception that is not caught
*/
...
...
@@ -394,6 +393,14 @@ abstract class Application extends Module
public
function
handleError
(
$code
,
$message
,
$file
,
$line
)
{
if
(
error_reporting
()
!==
0
)
{
// load ErrorException manually here because autoloading them will not work
// when error occurs while autoloading a class
if
(
!
class_exists
(
'\\yii\\base\\Exception'
,
false
))
{
require_once
(
__DIR__
.
'/Exception.php'
);
}
if
(
!
class_exists
(
'\\yii\\base\\ErrorException'
,
false
))
{
require_once
(
__DIR__
.
'/ErrorException.php'
);
}
$exception
=
new
ErrorException
(
$message
,
$code
,
$code
,
$file
,
$line
);
// in case error appeared in __toString method we can't throw any exception
...
...
@@ -402,6 +409,7 @@ abstract class Application extends Module
foreach
(
$trace
as
$frame
)
{
if
(
$frame
[
'function'
]
==
'__toString'
)
{
$this
->
handleException
(
$exception
);
return
;
}
}
...
...
@@ -418,6 +426,14 @@ abstract class Application extends Module
if
(
ErrorException
::
isFatalError
(
$error
))
{
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
))
{
require_once
(
__DIR__
.
'/Exception.php'
);
}
if
(
!
class_exists
(
'\\yii\\base\\ErrorException'
,
false
))
{
require_once
(
__DIR__
.
'/ErrorException.php'
);
}
$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
);
...
...
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