Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refresh-routes Invalid argument supplied for foreach() #29

Open
anas-shehadeh opened this issue Mar 15, 2015 · 2 comments
Open

refresh-routes Invalid argument supplied for foreach() #29

anas-shehadeh opened this issue Mar 15, 2015 · 2 comments

Comments

@anas-shehadeh
Copy link

refresh-routes
route
route2
route3

@webvimark
Copy link
Owner

Could you check 1 thing - I think you declared in some controller parameter $actions and set it null or some empty string ?

@dbd5
Copy link

dbd5 commented May 8, 2015

Hello webvimark,

The issue reported by @anas-shehadeh occurred when he accessed "refresh-routes" (/user-management/permission/refresh-routes?id=assignRolesToUsers)

While trying to implement your user management module, I encountered a similar error while applying the migrations, please see console trace below - specifically #10 suggests the function refreshRoutes() which uses the foreach() construct.

It appears "$toAdd = array_diff(array_keys($allRoutes), array_keys($currentRoutes));" is not returning what you expect. Could you take a look at this more closely?

Thanks for the solid work you've put into this extension

Regards,

Adam

screen shot 2015-05-08 at 6 44 13 am

*** applying m141207_001649_create_basic_user_permissions
Exception: Invalid argument supplied for foreach() (C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\BaseYii.php:517)
#0 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\BaseYii.php(517): yii\base\ErrorHandler->handleError(2, 'Invalid argumen...', 'C:\DEV\xampp\ht...', 517, Array)
#1 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\base\Object.php(105): yii\BaseYii::configure(Object(webvimark\modules\UserManagement\components\UserConfig), 'user')
#2 [internal function]: yii\base\Object->_construct('user', Array)
#3 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\di\Container.php(372): ReflectionClass->newInstanceArgs(Array)
#4 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\di\Container.php(151): yii\di\Container->build('webvimark\modul...', Array, Array)
#5 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\BaseYii.php(344): yii\di\Container->get('webvimark\modul...', Array, Array)
#6 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\base\Module.php(354): yii\BaseYii::createObject(Array, Array)
#7 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\webvimark\module-user-management\components\AuthHelper.php(264): yii\base\Module->getModule('user')
#8 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\webvimark\module-user-management\components\AuthHelper.php(251): webvimark\modules\UserManagement\components\AuthHelper::getRouteRecursive(Object(yii\consol\Application), Array)
#9 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\webvimark\module-user-management\models\rbacDB\Route.php(112): webvimark\modules\UserManagement\components\AuthHelper::getRoutes()
#10 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\webvimark\module-user-management\migrations\m141207_001649_create_basic_user_permissions.php(13): webvimark\modules\UserManagement\models\rbacDB\Route::refreshRoutes()
#11 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\db\Migration.php(81): m141207_001649_create_basic_user_permissions->safeUp()
#12 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(492): yii\db\Migration->up()
#13 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(129): yii\console\controllers\BaseMigrateController->migrateUp('m141207_001649
...')
#14 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#15 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#16 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#17 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\console\Controller.php(91): yii\base\Controller->runAction('', Array)
#18 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\base\Module.php(455): yii\console\Controller->runAction('', Array)
#19 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\console\Application.php(161): yii\base\Module->runAction('migrate', Array)
#20 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\console\Application.php(137): yii\console\Application->runAction('migrate', Array)
#21 C:\DEV\xampp\htdocs\Yiikrajee\advanced\vendor\yiisoft\yii2\base\Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#22 C:\DEV\xampp\htdocs\Yiikrajee\advanced\yii(31): yii\base\Application->run()
#23 {main}
*** failed to apply m141207_001649_create_basic_user_permissions (time: 0.037s)

Migration failed. The rest of the migrations are canceled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants