Fixes #4131: Security adjustments

It's a one-commit with minor adjustments ([typo fix](https://github.com/yiisoft/yii2/pull/4163/files#diff-975a833ec7c81b58cf332ea9c882c795R231), [unused import](https://github.com/yiisoft/yii2/pull/4163/files#diff-975a833ec7c81b58cf332ea9c882c795R10) and [removal of null-data check](https://github.com/yiisoft/yii2/pull/4163/files#diff-45220ab88012b2d4eb27a69410afb5e6R215)) of #4163
Moved to separate issue for further discussion: https://github.com/yiisoft/yii2/issues/4469