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

Fatal MySQL error when saving Channel settings with no Channel Form default author #124

Closed
derekjones opened this Issue Feb 11, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@derekjones
Copy link
Contributor

derekjones commented Feb 11, 2019

Description of the problem

Incorrect integer value: '' for column 'default_author'.

It looks like this can only occur if you have enough authors in the authorlist to engage the React list component, and never saved the Channel's settings before that occurred. The non-React lists will select the first option, and save a default author to the Channel's settings, even if not used. The React component does not force a selection however, so it submits with an empty string, an the resulting invalid value for an integer column in MySQL.

How To Reproduce
Steps to reproduce the behavior:

  1. Have 8+ authors in the authorlist
  2. Create a new channel
  3. Save settings, and do not select a Default Author for Channel Form
  4. See error below

Error Messages

SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'default_author' at row 1:
UPDATE `exp_channel_form_settings` SET `default_author` = '' WHERE `channel_form_settings_id` = 1


#0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('UPDATE `exp_cha...')
#1 ee/legacy/database/DB_driver.php(270): CI_DB_mysqli_driver->_execute('UPDATE `exp_cha...')
#2 ee/legacy/database/DB_driver.php(180): CI_DB_driver->simple_query('UPDATE `exp_cha...')
#3 ee/legacy/database/DB_active_rec.php(1477): CI_DB_driver->query('UPDATE `exp_cha...')
#4 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(129): CI_DB_active_record->update('channel_form_se...')
#5 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(99): EllisLab\ExpressionEngine\Service\Model\Query\Update->actOnGateway(Object(EllisLab\ExpressionEngine\Service\Model\SyntheticGateway), Object(EllisLab\ExpressionEngine\Model\Channel\ChannelFormSettings))
#6 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(48): EllisLab\ExpressionEngine\Service\Model\Query\Update->doWork(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelFormSettings))
#7 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(282): EllisLab\ExpressionEngine\Service\Model\Query\Update->run()
#8 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(248): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#9 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(71): EllisLab\ExpressionEngine\Service\Model\DataStore->updateQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#10 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(361): EllisLab\ExpressionEngine\Service\Model\Query\Builder->update()
#11 ee/EllisLab/ExpressionEngine/Service/Model/Association/Association.php(224): EllisLab\ExpressionEngine\Service\Model\Model->save()
#12 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(369): EllisLab\ExpressionEngine\Service\Model\Association\Association->save()
#13 ee/EllisLab/ExpressionEngine/Controller/Channels/Channels.php(1433): EllisLab\ExpressionEngine\Service\Model\Model->save()
#14 ee/EllisLab/ExpressionEngine/Controller/Channels/Channels.php(246): EllisLab\ExpressionEngine\Controller\Channels\Channels->saveChannel(Object(EllisLab\ExpressionEngine\Model\Channel\Channel))
#15 ee/EllisLab/ExpressionEngine/Controller/Channels/Channels.php(179): EllisLab\ExpressionEngine\Controller\Channels\Channels->form('2')
#16 [internal function]: EllisLab\ExpressionEngine\Controller\Channels\Channels->edit('1')

Environment Details:

  • Version: 5.1.3
  • PHP Version 7.2.8
  • MySQL Version 8.0.12
@derekjones

This comment has been minimized.

Copy link
Contributor Author

derekjones commented Mar 11, 2019

Looks like this may still be a problem if there are literally no authors available in the in_authorlist checks for members and groups. (#153)

@kevincupp

This comment has been minimized.

Copy link
Contributor

kevincupp commented Mar 11, 2019

Hmm, what should we do in this case? I guess since there has to be an author, we should should make this field required and let form validation take care of it?

@derekjones

This comment has been minimized.

Copy link
Contributor Author

derekjones commented Mar 11, 2019

It's only used if they are using channel form and allow guest authors, so seems to me that the field shouldn't be present in the form unless allow guest authors is toggled. In that case, form validation could get it, but there's no cue to the admin of why that list is empty and how to fix it.

Perhaps for now if the list is empty, we could force a 0 there, that would never collide with a member record, or accidentally select a member later on edit. Then maybe we could think a bit more with @jmathias about that particular bit of UI and what's necessary there.

kevincupp added a commit that referenced this issue Mar 11, 2019

Ensure Channel Form default author has a value
Fixes #153

Quick fix, may come back to revisit better validation: #124 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.