Browse Source

fixed endless error loop in error handler

this happended when `stream` was set on the response but the stream resouce was invalid
either because it was already sent or became invalid for some other cases.

fixes #9046
tags/2.0.6
Carsten Brandt 9 years ago
parent
commit
5d3532c649
  1. 1
      framework/CHANGELOG.md
  2. 5
      framework/web/ErrorHandler.php

1
framework/CHANGELOG.md

@ -22,6 +22,7 @@ Yii Framework 2 Change Log
- Bug #8661: Fixed `yii.activeForm.js` scrolling to top (nkovacs)
- Bug #8772: ActiveQuery failed removing duplicate records after join when the resultset did not contain the pk values e.g. after grouping (cebe)
- Bug #8900: Fixed determine active menu item with url-alias in route `\yii\widgets\Menu::isItemActive()` (demi)
- Bug #9046: Fixed problem with endless error loop when an error occurred after sending a stream or file download response to the user (cebe)
- Bug: Fixed string comparison in `BaseActiveRecord::unlink()` which may result in wrong comparison result for hash valued primary keys starting with `0e` (cebe)
- Bug: Pass correct action name to `yii\console\Controller::options()` when default action was requested (cebe)
- Bug: Automatic garbage collection in `yii\caching\FileCache` was not triggered (kidol)

5
framework/web/ErrorHandler.php

@ -69,7 +69,12 @@ class ErrorHandler extends \yii\base\ErrorHandler
{
if (Yii::$app->has('response')) {
$response = Yii::$app->getResponse();
// reset parameters of response to avoid interference with partially created response data
// in case the error occurred while sending the response.
$response->isSent = false;
$response->stream = null;
$response->data = null;
$response->content = null;
} else {
$response = new Response();
}

Loading…
Cancel
Save