craftcms/guest-entries

Upgrade from v2.1.3 to v2.2 causes Undefined index: sectionUid error

johnfmorton opened this issue · 8 comments

I have a site (running Craft 3.1.5) that already uses v2.1.3 with a form successfully submitting guest entries. After upgrading the site is brought down by an Undefined index error.

Here is a screenshot of the error:
http://share.jmx2.com/wPyM8X

Here is the Stack trace from my error log:

2019-01-29 15:02:56 [-][-][b9vv10blf81c1iohffioliqj66][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined index: sectionUid in /Users/john/Sites/mysite/vendor/craftcms/guest-entries/src/models/Settings.php:72
Stack trace:
#0 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Component.php(180): craft\guestentries\models\Settings->setSections()
#1 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Model.php(732): craft\guestentries\models\Settings->__set()
#2 /Users/john/Sites/mysite/vendor/craftcms/cms/src/base/Plugin.php(213): craft\guestentries\models\Settings->setAttributes()
#3 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Component.php(180): craft\guestentries\Plugin->setSettings()
#4 /Users/john/Sites/mysite/vendor/yiisoft/yii2/BaseYii.php(546): craft\guestentries\Plugin->__set()
#5 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure()
#6 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Module.php(158): craft\guestentries\Plugin->__construct()
#7 /Users/john/Sites/mysite/vendor/craftcms/cms/src/base/Plugin.php(127): craft\guestentries\Plugin->__construct()
#8 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(383): craft\guestentries\Plugin->__construct()
#9 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs()
#10 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build()
#11 /Users/john/Sites/mysite/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get()
#12 /Users/john/Sites/mysite/vendor/craftcms/cms/src/services/Plugins.php(890): yii\BaseYii::createObject()
#13 /Users/john/Sites/mysite/vendor/craftcms/cms/src/services/Plugins.php(223): craft\services\Plugins->createPlugin()
#14 /Users/john/Sites/mysite/vendor/craftcms/cms/src/base/ApplicationTrait.php(1208): craft\services\Plugins->loadPlugins()
#15 /Users/john/Sites/mysite/vendor/craftcms/cms/src/web/Application.php(112): craft\web\Application->_postInit()
#16 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#17 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Application.php(206): craft\web\Application->__construct()
#18 /Users/john/Sites/mysite/vendor/craftcms/cms/src/web/Application.php(100): craft\web\Application->__construct()
#19 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(383): craft\web\Application->__construct()
#20 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs()
#21 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build()
#22 /Users/john/Sites/mysite/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get()
#23 /Users/john/Sites/mysite/vendor/craftcms/cms/bootstrap/bootstrap.php(255): yii\BaseYii::createObject()
#24 /Users/john/Sites/mysite/vendor/craftcms/cms/bootstrap/web.php(42): ::unknown()
#25 /Users/john/Sites/mysite/web/index.php(20): ::unknown()
#26 /Users/john/.composer/vendor/laravel/valet/server.php(151): ::unknown()
#27 {main}

Some additional info:

I ran the ./craft update all command to update the plugin. This was before 3.1.6 came out.

After 3.1.6 came out, I attempted to update Craft only to 3.1.6 (from 3.1.5) via the command line using the ./craft update craft command. That failed in the migration process as well with the same error above, referencing the Guest Entries which I had not updated.

Here's the stack trace from that:

Fetching available updates ... done
Performing one update:

    - craft 3.1.5 => 3.1.6

Backup the database? (yes|no) [yes]:
Backing up the database ... done
Performing update with Composer ... done
Applying new migrations ... error: The command "'/Users/john/Sites/mysite/craft' 'migrate/all' '--no-content'" failed.

Exit Code: 1(General error)

Working directory: /Users/john/Sites/mysite

Output:
================


Error Output:
================
PHP Notice 'yii\base\ErrorException' with message 'Undefined index: sectionUid'

in /Users/john/Sites/mysite/vendor/craftcms/guest-entries/src/models/Settings.php:72

Stack trace:
#0 /Users/john/Sites/mysite/vendor/craftcms/guest-entries/src/models/Settings.php(72): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/Users/john/Sit...', 72, Array)
#1 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Component.php(180): craft\guestentries\models\Settings->setSections(Array)
#2 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Model.php(732): yii\base\Component->__set('sections', Array)
#3 /Users/john/Sites/mysite/vendor/craftcms/cms/src/base/Plugin.php(213): yii\base\Model->setAttributes(Array, false)
#4 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Component.php(180): craft\base\Plugin->setSettings(Array)
#5 /Users/john/Sites/mysite/vendor/yiisoft/yii2/BaseYii.php(546): yii\base\Component->__set('settings', Array)
#6 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\guestentries\Plugin), Array)
#7 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Module.php(158): yii\base\BaseObject->__construct(Array)
#8 /Users/john/Sites/mysite/vendor/craftcms/cms/src/base/Plugin.php(127): yii\base\Module->__construct('guest-entries', Object(craft\console\Application), Array)
#9 [internal function]: craft\base\Plugin->__construct('guest-entries', Object(craft\console\Application), Array)
#10 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#11 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\guestentr...', Array, Array)
#12 /Users/john/Sites/mysite/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\guestentr...', Array, Array)
#13 /Users/john/Sites/mysite/vendor/craftcms/cms/src/services/Plugins.php(890): yii\BaseYii::createObject(Array, Array)
#14 /Users/john/Sites/mysite/vendor/craftcms/cms/src/services/Plugins.php(223): craft\services\Plugins->createPlugin('guest-entries', Array)
#15 /Users/john/Sites/mysite/vendor/craftcms/cms/src/base/ApplicationTrait.php(1208): craft\services\Plugins->loadPlugins()
#16 /Users/john/Sites/mysite/vendor/craftcms/cms/src/console/Application.php(65): craft\console\Application->_postInit()
#17 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init()
#18 /Users/john/Sites/mysite/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#19 /Users/john/Sites/mysite/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array)
#20 /Users/john/Sites/mysite/vendor/craftcms/cms/src/console/Application.php(54): yii\console\Application->__construct(Array)
#21 [internal function]: craft\console\Application->__construct(Array)
#22 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(383): ReflectionClass->newInstanceArgs(Array)
#23 /Users/john/Sites/mysite/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('craft\\console\\A...', Array, Array)
#24 /Users/john/Sites/mysite/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->get('craft\\console\\A...', Array, Array)
#25 /Users/john/Sites/mysite/vendor/craftcms/cms/bootstrap/bootstrap.php(255): yii\BaseYii::createObject(Array)
#26 /Users/john/Sites/mysite/vendor/craftcms/cms/bootstrap/console.php(31): require('/Users/john/Sit...')
#27 /Users/john/Sites/mysite/craft(21): require('/Users/john/Sit...')
#28 {main}

But the interesting bit of this is that I then tried to update Craft from 3.1.5 to 3.1.6 using the control panel button on the Updates page. That worked. It successfully updated to 3.1.6. I thought that this button was only a way to run the same command as the command line did. Whatever the case is, it worked.

The update of Guest Entries did not successfully update this way though. It still threw the same error.

We got the same error after updating this plugin. We just updated the latest Craft version (3.1.6.1)

Me too. Please fix it. I have a website that is suspended.

Sam,

I was able to roll back to the previous version and it still works though. Can you roll back to the previous version? If not, I can tell you how I did that. Just let me know.

-John

I rolled back, but now i am stuck and can't install or update anything, cuz the composer updates the guest entries and it crashes again T_T
My website depends on this plugin very much and i am starting to get a bit worried.

@Sam-Black-0013 So you rolled back and did a new composer install but you still see the same error?

We just released 2.2.1 with a fix for this.

Nope Mr. john i just rolled back and stopped and waited for the fix to come up. the website is already on production stage so i can't really risk it at this point.