Browse Source

Fixes #7571: HTTP status 500 and "An internal server error occurred." are now returned in case there was an exception in layout and `YII_DEBUG` is false

tags/2.0.4
Alexander Makarov 10 years ago
parent
commit
b6a591c720
  1. 1
      framework/CHANGELOG.md
  2. 6
      framework/base/ErrorHandler.php

1
framework/CHANGELOG.md

@ -8,6 +8,7 @@ Yii Framework 2 Change Log
- Bug #7603: Fixed escape characters in `FormatConverter` to work with unicode characters (maddoger, cebe)
- Enh #7488: Added `StringHelper::explode` to perform explode with trimming and skipping of empty elements (SilverFire, nineinchnick, creocoder, samdark)
- Enh #7562: `yii help` now lists all sub-commands by default (callmez)
- Enh #7571: HTTP status 500 and "An internal server error occurred." are now returned in case there was an exception in layout and `YII_DEBUG` is false (samdark)
- Enh: Added `yii\helper\Console::wrapText()` method to wrap indented text by console window width and used it in `yii help` command (cebe)
- Chg: Updated dependency to `cebe/markdown` to version `1.1.x` (cebe)

6
framework/base/ErrorHandler.php

@ -107,9 +107,15 @@ abstract class ErrorHandler extends Component
} else {
echo '<pre>' . htmlspecialchars($msg, ENT_QUOTES, Yii::$app->charset) . '</pre>';
}
} else {
echo 'An internal server error occurred.';
}
$msg .= "\n\$_SERVER = " . VarDumper::export($_SERVER);
error_log($msg);
if (PHP_SAPI !== 'cli') {
http_response_code(500);
}
exit(1);
}

Loading…
Cancel
Save