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

Yii2 call to a member function getDB() on null after update to the latest version #15578

Closed
alexjohnp opened this issue Jan 30, 2018 · 2 comments

Comments

@alexjohnp
Copy link

Good morning,
after issuing a composer update, I run into this problem trying to authenticate to my application.
Login screen is ok. No authentication is possible (i.e. the problem arises after pressing the "login" button)

Error: Call to a member function getDb() on null in /var/www/html/gpl/vendor/dektrium/yii2-user/traits/ModuleTrait.php:28
Stack trace:
#0 /var/www/html/gpl/vendor/yiisoft/yii2/db/ActiveRecord.php(344): dektrium\user\models\User::getDb()
#1 /var/www/html/gpl/vendor/yiisoft/yii2/db/ActiveRecord.php(370): yii\db\ActiveRecord::getTableSchema()
#2 /var/www/html/gpl/vendor/yiisoft/yii2/db/ActiveRecord.php(177): yii\db\ActiveRecord::primaryKey()
#3 /var/www/html/gpl/vendor/yiisoft/yii2/db/BaseActiveRecord.php(107): yii\db\ActiveRecord::findByCondition(2)
#4 /var/www/html/gpl/vendor/dektrium/yii2-user/models/User.php(559): yii\db\BaseActiveRecord::findOne(2)
#5 /var/www/html/gpl/vendor/yiisoft/yii2/web/User.php(663): dektrium\user\models\User::findIdentity(2)
#6 /var/www/html/gpl/vendor/yiisoft/yii2/web/User.php(188): yii\web\User->renewAuthStatus()
#7 /var/www/html/gpl/vendor/yiisoft/yii2/web/User.php(333): yii\web\User->getIdentity()
#8 /var/www/html/gpl/vendor/yiisoft/yii2/base/Component.php(133): yii\web\User->getIsGuest()
#9 /var/www/html/gpl/vendor/yiisoft/yii2-debug/panels/UserPanel.php(81): yii\base\Component->__get('isGuest')
#10 /var/www/html/gpl/vendor/yiisoft/yii2/base/BaseObject.php(108): yii\debug\panels\UserPanel->init()
#11 [internal function]: yii\base\BaseObject->__construct(Array)
#12 /var/www/html/gpl/vendor/yiisoft/yii2/di/Container.php(381): ReflectionClass->newInstanceArgs(Array)
#13 /var/www/html/gpl/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('yii\debug\panel...', Array, Array)
#14 /var/www/html/gpl/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('yii\debug\panel...', Array, Array)
#15 /var/www/html/gpl/vendor/yiisoft/yii2-debug/Module.php(177): yii\BaseYii::createObject(Array)
#16 /var/www/html/gpl/vendor/yiisoft/yii2-debug/Module.php(149): yii\debug\Module->initPanels()
#17 /var/www/html/gpl/vendor/yiisoft/yii2/base/BaseObject.php(108): yii\debug\Module->init()
#18 /var/www/html/gpl/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#19 [internal function]: yii\base\Module->__construct('debug', Object(yii\web\Application), Array)
#20 /var/www/html/gpl/vendor/yiisoft/yii2/di/Container.php(375): ReflectionClass->newInstanceArgs(Array)
#21 /var/www/html/gpl/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('yii\debug\Modul...', Array, Array)
#22 /var/www/html/gpl/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('yii\debug\Modul...', Array, Array)
#23 /var/www/html/gpl/vendor/yiisoft/yii2/base/Module.php(427): yii\BaseYii::createObject(Array, Array)
#24 /var/www/html/gpl/vendor/yiisoft/yii2/base/Application.php(315): yii\base\Module->getModule('debug')
#25 /var/www/html/gpl/vendor/yiisoft/yii2/web/Application.php(69): yii\base\Application->bootstrap()
#26 /var/www/html/gpl/vendor/yiisoft/yii2/base/Application.php(273): yii\web\Application->bootstrap()
#27 /var/www/html/gpl/vendor/yiisoft/yii2/base/BaseObject.php(108): yii\base\Application->init()
#28 /var/www/html/gpl/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#29 /var/www/html/gpl/web/index.php(12): yii\base\Application->__construct(Array)
#30 {main}

What steps will reproduce the problem?

run composer update

What is the expected result?

user can access the application

What do you get instead?

call to a member function getDB on null

Additional info

Q A
Yii version 2.0.13.1
PHP version 7.0.22
Operating system Ubuntu 16.04 LTS
@samdark
Copy link
Member

samdark commented Jan 30, 2018

Seems it's an issue in updated version of an extension.

@samdark samdark closed this as completed Jan 30, 2018
@schmunk42
Copy link
Contributor

Check the config of your database component db and user module user - https://github.com/dektrium/yii2-user/blob/master/traits/ModuleTrait.php#L28

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