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
a2aa20f1
Commit
a2aa20f1
authored
May 11, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplified errorhandler registration.
parent
32aa175b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
31 deletions
+4
-31
Application.php
framework/base/Application.php
+2
-9
Application.php
framework/console/Application.php
+1
-11
Application.php
framework/web/Application.php
+1
-11
No files found.
framework/base/Application.php
View file @
a2aa20f1
...
...
@@ -184,9 +184,10 @@ abstract class Application extends Module
$this
->
state
=
self
::
STATE_BEGIN
;
$this
->
registerErrorHandler
(
$config
);
$this
->
preInit
(
$config
);
$this
->
registerErrorHandler
(
$config
);
Component
::
__construct
(
$config
);
}
...
...
@@ -309,14 +310,6 @@ abstract class Application extends Module
echo
"Error: no errorHandler component is configured.
\n
"
;
exit
(
1
);
}
// allow using ErrorHandler from the app namespace
if
(
strncmp
(
$config
[
'components'
][
'errorHandler'
][
'class'
],
'app\\'
,
4
)
===
0
)
{
if
(
isset
(
$config
[
'basePath'
]))
{
Yii
::
setAlias
(
'@app'
,
$config
[
'basePath'
]);
}
else
{
throw
new
InvalidConfigException
(
'The "basePath" configuration for the Application is required.'
);
}
}
$this
->
set
(
'errorHandler'
,
$config
[
'components'
][
'errorHandler'
]);
unset
(
$config
[
'components'
][
'errorHandler'
]);
$this
->
getErrorHandler
()
->
register
();
...
...
framework/console/Application.php
View file @
a2aa20f1
...
...
@@ -187,17 +187,7 @@ class Application extends \yii\base\Application
return
array_merge
(
parent
::
coreComponents
(),
[
'request'
=>
[
'class'
=>
'yii\console\Request'
],
'response'
=>
[
'class'
=>
'yii\console\Response'
],
'errorHandler'
=>
[
'class'
=>
'yii\web\ErrorHandler'
],
]);
}
/**
* Registers the errorHandler component as a PHP error handler.
*/
protected
function
registerErrorHandler
(
&
$config
)
{
if
(
!
isset
(
$config
[
'components'
][
'errorHandler'
][
'class'
]))
{
$config
[
'components'
][
'errorHandler'
][
'class'
]
=
'yii\\console\\ErrorHandler'
;
}
parent
::
registerErrorHandler
(
$config
);
}
}
framework/web/Application.php
View file @
a2aa20f1
...
...
@@ -149,17 +149,7 @@ class Application extends \yii\base\Application
'response'
=>
[
'class'
=>
'yii\web\Response'
],
'session'
=>
[
'class'
=>
'yii\web\Session'
],
'user'
=>
[
'class'
=>
'yii\web\User'
],
'errorHandler'
=>
[
'class'
=>
'yii\web\ErrorHandler'
],
]);
}
/**
* Registers the errorHandler component as a PHP error handler.
*/
protected
function
registerErrorHandler
(
&
$config
)
{
if
(
!
isset
(
$config
[
'components'
][
'errorHandler'
][
'class'
]))
{
$config
[
'components'
][
'errorHandler'
][
'class'
]
=
'yii\\web\\ErrorHandler'
;
}
parent
::
registerErrorHandler
(
$config
);
}
}
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