Browse Source

Overrides c651dbb7. `yii\web\ErrorHandler::loggableGlobals` renamed to `displayVars`

tags/3.0.0-alpha1
SilverFire - Dmitry Naumenko 9 years ago
parent
commit
7ac2bc13f7
  1. 2
      framework/CHANGELOG.md
  2. 13
      framework/web/ErrorHandler.php

2
framework/CHANGELOG.md

@ -72,7 +72,7 @@ Yii Framework 2 Change Log
- Chg #9369: `Yii::$app->user->can()` now returns `false` instead of erroring in case `authManager` component is not configured (creocoder)
- Chg #9411: `DetailView` now automatically sets container tag ID in case it's not specified (samdark)
- Chg #9953: `TimestampBehavior::getValue()` changed to make value processing consistent with `AttributeBehavior::getValue()` (silverfire)
- Chg #6419: Added `yii\web\ErrorHandler::loggableGlobals` to make list logging global variables customizable. `$_ENV` and `$_SERVER` are not logged by default anymore (silverfire)
- Chg #6419: Added `yii\web\ErrorHandler::displayVars` make list of displayed vars customizable. `$_ENV` and `$_SERVER` are not displayed by default anymore (silverfire)
- New #10083: Added wrapper for PHP webserver (samdark)
- New: Added new requirement: ICU Data version >= 49.1 (SilverFire)

13
framework/web/ErrorHandler.php

@ -60,12 +60,13 @@ class ErrorHandler extends \yii\base\ErrorHandler
*/
public $previousExceptionView = '@yii/views/errorHandler/previousException.php';
/**
* @var array the variables that will be dumped from the $GLOBALS array.
* Defaults to: `['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']`
* @var array list of the PHP predefined variables that should be displayed on the error page.
* Note that a variable must be accessible via `$GLOBALS`. Otherwise it won't be displayed.
* Defaults to `['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']`.
* @see renderRequest()
* @since 2.0.7
*/
public $loggableGlobals = ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION'];
public $displayVars = ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION'];
/**
* Renders the exception.
@ -296,14 +297,14 @@ class ErrorHandler extends \yii\base\ErrorHandler
/**
* Renders the global variables of the request.
* List of global variables is defined in [[loggableGlobals]].
* List of global variables is defined in [[displayVars]].
* @return string the rendering result
* @see loggableGlobals
* @see displayVars
*/
public function renderRequest()
{
$request = '';
foreach ($this->loggableGlobals as $name) {
foreach ($this->displayVars as $name) {
if (!empty($GLOBALS[$name])) {
$request .= '$' . $name . ' = ' . VarDumper::export($GLOBALS[$name]) . ";\n\n";
}

Loading…
Cancel
Save