yii2: CSRF fails if mbstring.encoding_translation set to On
What steps will reproduce the problem?
I config php.ini with information bellow:
[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.encoding_translation = On
What is the expected result?
When I submit a form on website, I seen error
Error Bad Request (#400) Unable to verify your data submission
Additional info
| Q | A |
|---|---|
| Yii version | 2.0.12 |
| PHP version | 7.0.20 |
| Operating system | Windows |
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (11 by maintainers)
More specificly, hashed CSRF cookie data value
$calculatedHashdiffers form its stored hash value$hash, so validation fails inyii\base\Security. As i checked, in my case it happens in updated version, in the previous version CSRF cookie data value differs from the updated one and data validation works as it should.In log traces it looks like:
should be fixed by #14590