Setting unknown property: yii\base\Security::cryptBlockSize

Hi,

I’ve recently migrated to Yii2 RC following this guide: https://github.com/yiisoft/yii2/blob/2.0.0-rc/framework/UPGRADE.md.

It said to add the following in the configuration file:


'security' => [

            'cryptBlockSize' => 16,

            'cryptKeySize' => 24,

            'derivationIterations' => 1000,

            'deriveKeyStrategy' => 'hmac', // for PHP version < 5.5.0

            //'deriveKeyStrategy' => 'pbkdf2', // for PHP version >= 5.5.0

            'useDeriveKeyUniqueSalt' => false,

        ],

I get the following error when I run my application:


Unknown Property – yii\base\UnknownPropertyException

Setting unknown property: yii\base\Security::cryptBlockSize

The application works fine without this configuration and I can log in using database as usual (I’m using Security methods in the User model for hashing). I am using PHP version 5.5.9 running on Apache 2 Ubuntu 14.04 x64.

This is my confuguration file (config/web.php):


<?php


$params = require(__DIR__ . '/params.php');

$db = require(__DIR__ . '/db.php');


$config = [

    'name' => 'My App Name',

    'id' => 'my_app_id',

    'basePath' => dirname(__DIR__),

    'bootstrap' => ['log'],

    'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),

    'aliases' => [

        '@myappname' => '@app/components/myappname',

    ],

    'components' => [

        'security' => [

            'cryptBlockSize' => 16,

            'cryptKeySize' => 24,

            'derivationIterations' => 1000,

            //'deriveKeyStrategy' => 'hmac', // for PHP version < 5.5.0

            'deriveKeyStrategy' => 'pbkdf2', // for PHP version >= 5.5.0

            'useDeriveKeyUniqueSalt' => false,

        ],

        'cache' => [

            'class' => 'yii\caching\FileCache',

            'keyPrefix' => 'awesomeprefix!@#$%^&'

        ],

        'user' => [

            'identityClass' => 'app\models\User',

            'enableAutoLogin' => true,

        ],

        'errorHandler' => [

            'errorAction' => 'site/error',

        ],

        'mail' => [

            'class' => 'yii\swiftmailer\Mailer',

            'useFileTransport' => true,

        ],

        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets' => [

                [

                    'class' => 'yii\log\FileTarget',

                    'levels' => ['error', 'warning'],

                ],

            ],

        ],

        'request' => [

            'cookieValidationKey' => 'awesomevalidationkey!@#$%^&',

        ],

        'db' => $db,

    ],

    'params' => $params,

];


if (YII_ENV_DEV) {

    // configuration adjustments for 'dev' environment

    $config['bootstrap'][] = 'debug';

    $config['modules']['debug'] = 'yii\debug\Module';

    $config['modules']['gii'] = 'yii\gii\Module';

}


return $config;



Tell me if you need to see any code,

Thanks

Updated UPGRADE. You don’t need adjustments except derivationIterations.