Bug #9670: Fixed PJAX redirect in IE

This commit is contained in:
SilverFire - Dmitry Naumenko
2015-12-26 10:19:22 +02:00
parent 82acc3464d
commit dc93ec3812
2 changed files with 3 additions and 1 deletions

View File

@@ -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 #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 #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 #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 #9678: `I18N::format()` wasn't able to handle named placeholder in "selectordinal" (samdark)
- Bug #9681: `Json::encode()` was erroring under CYGWIN (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) - Bug #9689: Hidden input on `Html::activeFileInput()` had the wrong name if a name was explicitly given (graphcon, cebe)

View File

@@ -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 * 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 * 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. * 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 * @return $this the response object itself
*/ */
public function redirect($url, $statusCode = 302, $checkAjax = true) public function redirect($url, $statusCode = 302, $checkAjax = true)
@@ -758,7 +759,7 @@ class Response extends \yii\base\Response
$url = Yii::$app->getRequest()->getHostInfo() . $url; $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()) { if (Yii::$app->getRequest()->getIsPjax()) {
$this->getHeaders()->set('X-Pjax-Url', $url); $this->getHeaders()->set('X-Pjax-Url', $url);
} elseif (Yii::$app->getRequest()->getIsAjax()) { } elseif (Yii::$app->getRequest()->getIsAjax()) {