Commit a92e214b by Qiang Xue

Fixes #5770: Added more PHP error names for `ErrorException`

parent b2341edf
...@@ -25,6 +25,7 @@ Yii Framework 2 Change Log ...@@ -25,6 +25,7 @@ Yii Framework 2 Change Log
- Enh #5613: Added `--overwrite` option to Gii console command to support overwriting all files (motin, qiangxue) - Enh #5613: Added `--overwrite` option to Gii console command to support overwriting all files (motin, qiangxue)
- Enh #5646: Call `yii\base\ErrorHandler::unregister()` instead of `restore_*_handlers` directly (aivus) - Enh #5646: Call `yii\base\ErrorHandler::unregister()` instead of `restore_*_handlers` directly (aivus)
- Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk) - Enh #5735: Added `yii\bootstrap\Tabs::renderTabContent` to support manually rendering tab contents (RomeroMsk)
- Enh #5770: Added more PHP error names for `ErrorException` (mongosoft)
- Enh #5806: Allow `Html::encode()` to be used when the application is not started (qiangxue) - Enh #5806: Allow `Html::encode()` to be used when the application is not started (qiangxue)
- Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe) - Enh: `Console::confirm()` now uses `Console::stdout()` instead of `echo` to be consistent with all other functions (cebe)
- Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark) - Chg #3630: `yii\db\Command::queryInternal()` is now protected (samdark)
......
...@@ -73,22 +73,22 @@ class ErrorException extends \ErrorException ...@@ -73,22 +73,22 @@ class ErrorException extends \ErrorException
*/ */
public function getName() public function getName()
{ {
$names = [ static $names = [
E_ERROR => 'PHP Fatal Error',
E_WARNING => 'PHP Warning',
E_PARSE => 'PHP Parse Error',
E_NOTICE => 'PHP Notice',
E_CORE_ERROR => 'PHP Core Error',
E_CORE_WARNING => 'PHP Core Warning',
E_COMPILE_ERROR => 'PHP Compile Error', E_COMPILE_ERROR => 'PHP Compile Error',
E_COMPILE_WARNING => 'PHP Compile Warning', E_COMPILE_WARNING => 'PHP Compile Warning',
E_USER_ERROR => 'PHP User Error', E_CORE_ERROR => 'PHP Core Error',
E_USER_WARNING => 'PHP User Warning', E_CORE_WARNING => 'PHP Core Warning',
E_USER_NOTICE => 'PHP User Notice',
E_STRICT => 'PHP Strict Warning',
E_RECOVERABLE_ERROR => 'PHP Recoverable Error',
E_DEPRECATED => 'PHP Deprecated Warning', E_DEPRECATED => 'PHP Deprecated Warning',
E_ERROR => 'PHP Fatal Error',
E_NOTICE => 'PHP Notice',
E_PARSE => 'PHP Parse Error',
E_RECOVERABLE_ERROR => 'PHP Recoverable Error',
E_STRICT => 'PHP Strict Warning',
E_USER_DEPRECATED => 'PHP User Deprecated Warning', E_USER_DEPRECATED => 'PHP User Deprecated Warning',
E_USER_ERROR => 'PHP User Error',
E_USER_NOTICE => 'PHP User Notice',
E_USER_WARNING => 'PHP User Warning',
E_WARNING => 'PHP Warning',
]; ];
return isset($names[$this->getCode()]) ? $names[$this->getCode()] : 'Error'; return isset($names[$this->getCode()]) ? $names[$this->getCode()] : 'Error';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment