-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor errorhandler #2916
Refactor errorhandler #2916
Conversation
} | ||
// it is too late to log an error message here | ||
$exception = ErrorHandler::convertExceptionToString($e); | ||
// its too late to use Yii logging here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it's too late?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the original issue: https://code.google.com/p/yii/issues/detail?id=1120&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Stars%20Summary
Not sure if it still applies for PHP 5.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's still there: http://php.net/manual/en/function.session-set-save-handler.php
The "write" handler is not executed until after the output stream is closed. Thus, output from debugging statements in the "write" handler will never be seen in the browser. If debugging output is necessary, it is suggested that the debug output be written to a file instead.
return '<a href="http://yiiframework.com/doc/api/2.0/' . $this->htmlEncode($matches[1]) . '" target="_blank">' . | ||
$this->htmlEncode($matches[1]) . '</a>()'; | ||
}, $code); | ||
$message .= $this->formatMessage(" '" . get_class($exception) . "'", [Console::BOLD, Console::FG_BLUE]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be extracted into ConsoleErrorHandler::renderException
Ready for merge now. |
*/ | ||
public function createServerInformationLink() | ||
{ | ||
static $serverUrls = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why static ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not? Note that this is just copied from base errorhandler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need to keep some instances between objects so it can be here simple $serverUrls
, there is no such situation as in Yii1 with CLocale
where we need to store all locales for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static will ensure this array is stored only once even in multiple calls. I see no problem as it is constant. Also this only appears when an error page is rendered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, but i dont think that this is the case to ensure that stored only once
, anyway it is good to have fine console exception now.
Looks good to me. Good job! |
check how ErrorHandler reacts to error_reporting settingfixes #1946, fixes #2516
looks like tests are failing because it was February last month :-)