johnitvn / yii2-user-plus

High flexible user management extension for yii2
23 stars 22 forks source link

Syntax error in base/Module.php ? #7

Open rimas-kudelis opened 9 years ago

rimas-kudelis commented 9 years ago

I get the following error when trying to run migration:

PHP Parse error:  syntax error, unexpected '*', expecting ',' or ';' in .../vendor/johnitvn/yii2-user-plus/src/base/Module.php on line 20
PHP Stack trace:
PHP   1. {main}() .../yii:0
PHP   2. yii\console\Application->__construct() .../yii:18
PHP   3. yii\base\Application->__construct() .../vendor/yiisoft/yii2/console/Application.php:85
PHP   4. yii\base\Object->__construct() .../vendor/yiisoft/yii2/base/Application.php:206
PHP   5. yii\console\Application->init() .../vendor/yiisoft/yii2/base/Object.php:107
PHP   6. yii\base\Application->init() .../vendor/yiisoft/yii2/console/Application.php:120
PHP   7. yii\base\Application->bootstrap() .../vendor/yiisoft/yii2/base/Application.php:267
PHP   8. johnitvn\userplus\Bootstrap->bootstrap() .../vendor/yiisoft/yii2/base/Application.php:291
PHP   9. yii\base\Module->getModule() .../vendor/johnitvn/yii2-user-plus/src/Bootstrap.php:37
PHP  10. yii\BaseYii::createObject() .../vendor/yiisoft/yii2/base/Module.php:354
PHP  11. yii\di\Container->get() .../vendor/yiisoft/yii2/BaseYii.php:340
PHP  12. yii\di\Container->build() .../vendor/yiisoft/yii2/di/Container.php:151
PHP  13. yii\di\Container->getDependencies() .../vendor/yiisoft/yii2/di/Container.php:358
PHP  14. ReflectionClass->__construct() .../vendor/yiisoft/yii2/di/Container.php:415
PHP  15. spl_autoload_call() .../vendor/yiisoft/yii2/di/Container.php:415
PHP  16. yii\BaseYii::autoload() .../vendor/yiisoft/yii2/di/Container.php:0
PHP  17. include() .../vendor/yiisoft/yii2/BaseYii.php:288
PHP  18. spl_autoload_call() .../vendor/yiisoft/yii2/BaseYii.php:28
PHP  19. yii\BaseYii::autoload() .../vendor/yiisoft/yii2/BaseYii.php:0
PHP  20. include() .../vendor/yiisoft/yii2/BaseYii.php:288
PHP  21. spl_autoload_call() .../vendor/yiisoft/yii2/BaseYii.php:24
PHP  22. yii\BaseYii::autoload() .../vendor/yiisoft/yii2/BaseYii.php:0
PHP Parse Error 'yii\base\ErrorException' with message 'syntax error, unexpected '*', expecting ',' or ';''

Line 20 is this:

    public $rememberFor = 3600 * 24;

Interestingly, I think this should work, at least according to the PHP manual (because the result of this multiplication is known at compile time). Any idea why it would not work?

TeeJet commented 8 years ago

Property can't keep expression. It should be changed to: public $rememberFor = 86400;

leshik21 commented 8 years ago

It was fixed in several forks. If you are using composer, you can download fork in your project. Add repository to "repositories" section in your main composer.json: "repositories": [ { "type": "vcs", "url": "https://github.com/leshik21/yii2-user-plus" } ], In "requre" section there should be: "johnitvn/yii2-user-plus": "dev-master" Then update composer.