mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixes #897.
This commit is contained in:
@ -93,6 +93,8 @@ class ErrorHandler extends Component
|
||||
$response->getHeaders()->removeAll();
|
||||
|
||||
if ($useErrorView && $this->errorAction !== null) {
|
||||
// disable CSRF validation so that errorAction can run in case the error is caused by CSRF validation failure
|
||||
Yii::$app->getRequest()->enableCsrfValidation = false;
|
||||
$result = Yii::$app->runAction($this->errorAction);
|
||||
if ($result instanceof Response) {
|
||||
$response = $result;
|
||||
|
@ -1001,7 +1001,8 @@ class Request extends \yii\base\Request
|
||||
*/
|
||||
public function getCsrfTokenFromHeader()
|
||||
{
|
||||
return isset($_SERVER[self::CSRF_HEADER]) ? $_SERVER[self::CSRF_HEADER] : null;
|
||||
$key = 'HTTP_' . str_replace('-', '_', strtoupper(self::CSRF_HEADER));
|
||||
return isset($_SERVER[$key]) ? $_SERVER[$key] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user