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

error in \yii\console\controllers\HelpController::getModuleCommands() #15446

Open
buchenko opened this issue Jan 2, 2018 · 0 comments
Open
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug

Comments

@buchenko
Copy link

buchenko commented Jan 2, 2018

What steps will reproduce the problem?

  1. connect a module that uses controllerMap (for example, yii2-user)
  2. run the command php yii

What is the expected result?

list of console commands

What do you get instead?

Exception 'yii\base\InvalidConfigException' with message 'Failed to instantiate component or class "user".'

in C:\WebServers\home\sait.local\vendor\yiisoft\yii2\di\Instance.php:139

Stack trace:
#0 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\filters\AccessControl.php(100): yii\di\Instance::ensure('user', 'yii\web\User')
#1 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Object.php(107): yii\filters\AccessControl->init()
#2 [internal function]: yii\base\Object->__construct(Array)
#3 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\di\Container.php(381): ReflectionClass->newInstanceArgs(Array)
#4 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('yii\filters\Acc...', Array, Array)
#5 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\BaseYii.php(348): yii\di\Container->get('yii\filters\Acc...', Array, Array)
#6 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Component.php(667): yii\BaseYii::createObject(Array)
#7 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Component.php(651): yii\base\Component->attachBehaviorInternal('access', Array)
#8 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Component.php(483): yii\base\Component->ensureBehaviors()
#9 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Component.php(177): yii\base\Component->on('afterRequest', Object(Closure))
#10 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\BaseYii.php(529): yii\base\Component->__set('on afterRequest', Object(Closure))
#11 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Object.php(105): yii\BaseYii::configure(Object(dektrium\user\controllers\RecoveryController), Array)
#12 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Controller.php(86): yii\base\Object->__construct(Array)
#13 C:\WebServers\home\sait.local\vendor\dektrium\yii2-user\controllers\RecoveryController.php(83): yii\base\Controller->__construct('recovery', Object(dektrium\user\Module), Array)
#14 [internal function]: dektrium\user\controllers\RecoveryController->__construct('recovery', Object(dektrium\user\Module), Object(dektrium\user\Finder), Array)
#15 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\di\Container.php(381): ReflectionClass->newInstanceArgs(Array)
#16 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('dektrium\user\c...', Array, Array)
#17 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\BaseYii.php(348): yii\di\Container->get('dektrium\user\c...', Array, Array)
#18 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Module.php(578): yii\BaseYii::createObject(Array, Array)
#19 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Module.php(583): yii\base\Module->createController('recovery')
#20 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\console\controllers\HelpController.php(196): yii\base\Module->createController('user/recovery')
#21 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\console\controllers\HelpController.php(288): yii\console\controllers\HelpController->getCommandDescriptions()
#22 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\console\controllers\HelpController.php(67): yii\console\controllers\HelpController->getDefaultHelp()
#23 [internal function]: yii\console\controllers\HelpController->actionIndex(NULL)
#24 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#25 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#26 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\console\Controller.php(128): yii\base\Controller->runAction('', Array)
#27 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Module.php(523): yii\console\Controller->runAction('', Array)
#28 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction('', Array)
#29 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction('', Array)
#30 C:\WebServers\home\sait.local\vendor\yiisoft\yii2\base\Application.php(380): yii\console\Application->handleRequest(Object(yii\console\Request))
#31 C:\WebServers\home\sait.local\yii(27): yii\base\Application->run()
#32 {main}

Additional info

/vendor/yiisoft/yii2/console/controllers/HelpController.php:240

        foreach (array_keys($module->controllerMap) as $id) {
            $commands[] = $prefix . $id; // <- this is controller
        }

and need validate by:

$this->validateControllerClass($controllerClass)
Q A
Yii version 2.0.12
PHP version 5.6.30
Operating system win 10
@samdark samdark added status:to be verified Needs to be reproduced and validated. type:bug Bug labels Jan 7, 2018
@samdark samdark added this to the 2.0.15 milestone Jan 7, 2018
@samdark samdark removed this from the 2.0.16 milestone Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants