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

Crashes craft with error on install #4

Closed
havardlj opened this issue Sep 29, 2020 · 6 comments
Closed

Crashes craft with error on install #4

havardlj opened this issue Sep 29, 2020 · 6 comments
Assignees

Comments

@havardlj
Copy link

Exception 'Error' with message 'Call to a member function getSettings() on null'

in /Users/myuser/Dev/myproject.dev/vendor/billythekid/recaptchaguest/src/Recaptchaguest.php:61

Stack trace:
#0 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/base/BaseObject.php(109): billythekid\recaptchaguest\Recaptchaguest->init()
#1 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#2 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/src/base/Plugin.php(115): yii\base\Module->__construct('recaptchaguest', Object(craft\console\Application), Array)
#3 [internal function]: craft\base\Plugin->__construct('recaptchaguest', Object(craft\console\Application), Array)
#4 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/di/Container.php(406): ReflectionClass->newInstanceArgs(Array)
#5 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/di/Container.php(165): yii\di\Container->build('billythekid\rec...', Array, Array)
#6 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('billythekid\rec...', Array, Array)
#7 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/src/services/Plugins.php(908): yii\BaseYii::createObject(Array, Array)
#8 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/src/services/Plugins.php(227): craft\services\Plugins->createPlugin('recaptchaguest', Array)
#9 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/src/base/ApplicationTrait.php(1416): craft\services\Plugins->loadPlugins()
#10 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/src/console/Application.php(61): craft\console\Application->_postInit()
#11 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#12 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#13 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#14 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/src/console/Application.php(50): yii\console\Application->__construct(Array)
#15 [internal function]: craft\console\Application->__construct(Array)
#16 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/di/Container.php(406): ReflectionClass->newInstanceArgs(Array)
#17 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/di/Container.php(165): yii\di\Container->build('craft\console\A...', Array, Array)
#18 /Users/myuser/Dev/myproject.dev/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\console\A...', Array, Array)
#19 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/bootstrap/bootstrap.php(246): yii\BaseYii::createObject(Array)
#20 /Users/myuser/Dev/myproject.dev/vendor/craftcms/cms/bootstrap/console.php(51): require('/Users/myuser...')
#21 /Users/myuser/Dev/myproject.dev/craft(22): require('/Users/myuser...')
#22 {main}

@billythekid
Copy link
Owner

Hi @havardlj thanks for raising this issue and apologies for not getting back to you before now, for some reason I missed the notification.

I'll look into this as soon as I can and get back to you, hopefully with a fix.

@camelskyscraper
Copy link

camelskyscraper commented Dec 19, 2020

I think I just encountered the same issue. Added recaptchaguest via plugin store, everything was fine, then added recaptcha (v2) via plugin store and got a similar error report as shown above. Was there a resolution on this? Any tips on how to fix or what to explore? Craft 3.5.17.1

Error: Call to a member function getSettings() on null in /Users/person/project/online/vendor/billythekid/recaptchaguest/src/Recaptchaguest.php:61
Stack trace:
#0 /Users/person/project/online/vendor/yiisoft/yii2/base/BaseObject.php(109): billythekid\recaptchaguest\Recaptchaguest->init()
#1 /Users/person/project/online/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#2 /Users/person/project/online/vendor/craftcms/cms/src/base/Plugin.php(115): yii\base\Module->__construct('recaptchaguest', Object(craft\web\Application), Array)
#3 [internal function]: craft\base\Plugin->__construct('recaptchaguest', Object(craft\web\Application), Array)
#4 /Users/person/project/online/vendor/yiisoft/yii2/di/Container.php(406): ReflectionClass->newInstanceArgs(Array)
#5 /Users/person/project/online/vendor/yiisoft/yii2/di/Container.php(165): yii\di\Container->build('billythekid\rec...', Array, Array)
#6 /Users/person/project/online/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('billythekid\rec...', Array, Array)
#7 /Users/person/project/online/vendor/craftcms/cms/src/services/Plugins.php(925): yii\BaseYii::createObject(Array, Array)
#8 /Users/person/project/online/vendor/craftcms/cms/src/services/Plugins.php(228): craft\services\Plugins->createPlugin('recaptchaguest', Array)
#9 /Users/person/project/online/vendor/craftcms/cms/src/base/ApplicationTrait.php(1418): craft\services\Plugins->loadPlugins()
#10 /Users/person/project/online/vendor/craftcms/cms/src/web/Application.php(93): craft\web\Application->_postInit()
#11 /Users/person/project/online/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#12 /Users/person/project/online/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#13 [internal function]: yii\base\Application->__construct(Array)
#14 /Users/person/project/online/vendor/yiisoft/yii2/di/Container.php(406): ReflectionClass->newInstanceArgs(Array)
#15 /Users/person/project/online/vendor/yiisoft/yii2/di/Container.php(165): yii\di\Container->build('craft\web\Appli...', Array, Array)
#16 /Users/person/project/online/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\web\Appli...', Array, Array)
#17 /Users/person/project/online/vendor/craftcms/cms/bootstrap/bootstrap.php(246): yii\BaseYii::createObject(Array)
#18 /Users/person/project/online/vendor/craftcms/cms/bootstrap/web.php(51): require('/Users/kirkrobe...')
#19 /Users/person/project/online/public_html/index.php(21): require('/Users/kirkrobe...')
#20 {main}

@billythekid
Copy link
Owner

billythekid commented Dec 20, 2020

Hi @havardlj and @camelskyscraper,

I've been able to replicate this today.

I think it's because of installing the recaptcha plugin from the plugin store after installing this one. This plugin installs the recaptcha one as a dependency anyway so that step shouldn't be required. I'm not sure why actually requiring it seperately should have any effect whatsoever though. It shouldn't make a difference if it's explicitly requried in your own composer.json or installed as a dependency via this package.

Nevertheless I plan on getting to the bottom of this and releasing a fix shortly.

Thanks to you both for bringing this up.

@billythekid
Copy link
Owner

billythekid commented Dec 20, 2020

Hi again @havardlj and @camelskyscraper,

I've just released an update that fixed this in my testing. Turns out it was some weird thing where Craft was reporting the recaptcha plugin as being installed and loaded, but actually trying to access it was giving null. A bit of re-organising the code so it doesn't check until the event fires (so all plugins really ARE loaded) seems to have done the trick.

Please let me know how you get on and if you need anything more.

Cheers,
Billy

@camelskyscraper
Copy link

camelskyscraper commented Jan 27, 2021

Thank you @billythekid for following up on this. The project I was working on was delayed and finally restarted so I would like to see it your update fixes the issue I was having. I don't see an update in my control panel Updates list for this plugin, though. The installed version of recaptchaguest is 1.0.4. I apologize for my ignorance on how to proceed. Can you point me in the right direction, please?

edit — if it matters, I just updated Craft to 3.6.1

@billythekid
Copy link
Owner

Hi @camelskyscraper I just checked packagist and it's showing 1.0.5 so not sure why it's not alerting to an update. Might be some other meta thing. Will check ASAP and let you know.

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

No branches or pull requests

3 participants