From dc93ec38129ca25541ee92520fe7c89862d01414 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Sat, 26 Dec 2015 10:19:22 +0200 Subject: [PATCH] Bug #9670: Fixed PJAX redirect in IE --- framework/CHANGELOG.md | 1 + framework/web/Response.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ea61588541..1da8a2efa6 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -23,6 +23,7 @@ Yii Framework 2 Change Log - Bug #9583: Server response on invalid JSON request included a wrong message about "Internal Server Error" with status 500 (cebe) - Bug #9591: Fixed `yii.validation.js` code so it is compressable by YUICompressor (samdark, hofrob) - Bug #9596: Fixed `\yii\web\UrlManager::createAbsoluteUrl(['site/index', '#' => 'testHash'])` losing hash (alchimik, samdark) +- Bug #9670: Fixed PJAX redirect in IE. `yii\web\Response::redirect()` - added check for `X-Ie-Redirect-Compatibility` header (silverfire) - Bug #9678: `I18N::format()` wasn't able to handle named placeholder in "selectordinal" (samdark) - Bug #9681: `Json::encode()` was erroring under CYGWIN (samdark) - Bug #9689: Hidden input on `Html::activeFileInput()` had the wrong name if a name was explicitly given (graphcon, cebe) diff --git a/framework/web/Response.php b/framework/web/Response.php index 19adeeee46..e22ae9350d 100644 --- a/framework/web/Response.php +++ b/framework/web/Response.php @@ -745,6 +745,7 @@ class Response extends \yii\base\Response * meaning if the current request is an AJAX or PJAX request, then calling this method will cause the browser * to redirect to the given URL. If this is false, a `Location` header will be sent, which when received as * an AJAX/PJAX response, may NOT cause browser redirection. + * Takes effect only when request header `X-Ie-Redirect-Compatibility` is absent. * @return $this the response object itself */ public function redirect($url, $statusCode = 302, $checkAjax = true) @@ -758,7 +759,7 @@ class Response extends \yii\base\Response $url = Yii::$app->getRequest()->getHostInfo() . $url; } - if ($checkAjax) { + if ($checkAjax && Yii::$app->getRequest()->getHeaders()->get('X-Ie-Redirect-Compatibility') !== null) { if (Yii::$app->getRequest()->getIsPjax()) { $this->getHeaders()->set('X-Pjax-Url', $url); } elseif (Yii::$app->getRequest()->getIsAjax()) {