only close output buffer if it is still open

Pjax did alredy close it before ExitException

fixes #8506
This commit is contained in:
Carsten Brandt
2015-05-21 14:22:53 +02:00
parent 72a463ec65
commit 1fe171b328
2 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@ Yii Framework 2 Change Log
- Bug #7707: client-side `trim` validator now passes the trimmed value to subsequent validators (nkovacs)
- Bug #8322: `yii\behaviors\TimestampBehavior::touch()` now throws an exception if owner is new record (klimov-paul)
- Bug #8451: `yii\i18n\Formatter` did not allow negative unix timestamps as input for date formatting (cebe)
- Bug #8506: Cleaning of output buffer in `Widget::run()` conflicts with `Pjax` widget which did the cleanup itself (cebe, joester89)
- Bug: Fixed string comparison in `BaseActiveRecord::unlink()` which may result in wrong comparison result for hash valued primary keys starting with `0e` (cebe)
- Enh #7169: `yii\widgets\ActiveField` now uses corresponding methods for default parts rendering (klimov-paul)
- Enh #8070: `yii\console\controllers\MessageController` now sorts created messages, even if there is no new one, while saving to PHP file (klimov-paul)

View File

@ -96,7 +96,10 @@ class Widget extends Component implements ViewContextInterface
$widget = Yii::createObject($config);
$out = $widget->run();
} catch(\Exception $e) {
ob_end_clean();
// close the output buffer opened above if it has not been closed already
if(ob_get_level() > 0) {
ob_end_clean();
}
throw $e;
}