EE compatibility updates:

  • Publisher is EE5 compatible, but it does not currently support the Fluid field.

ExpressionEngine.com licenses:

  • If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: “Exception Caught” on draft preview

Status Resolved
Add-on / Version Publisher Lite 3.2.2
Severity
EE Version 5.3.2

James Brown

Dec 11, 2020

I’m getting an Exception Caught error (see below) that takes over the entire page when I try and preview a draft on a page. If I hit the back button I see the Publisher modal that would contain the preview (although it is just a blank white screen) along with the preview link. If I click the preview link I do get to see the actual draft preview. Looking at the error message I see it is referencing a field that cannot be Null. That particular field is an EE toggle field. I tried previewing the page with it both set on and off with the same error message. That field is not a required field. I didn’t see anything else in the error message that stood out to me. Not sure what the issue is. Any ideas?

Exception Caught
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_id_57' cannot be null:
UPDATE `exp_channel_data_field_57` SET `field_id_57` = NULL WHERE `entry_id` = 3524
ee/legacy/database/drivers/mysqli/mysqli_connection.php:117

Stack Trace: Please include when reporting this error
#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 user/addons/publisher/Service/Entry/Entry.php(580): CI_DB_active_record->update('exp_channel_dat…', Array)
#5 user/addons/publisher/ext.publisher.php(559): BoldMinded\Publisher\Service\Entry\Entry->cleanup(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
#6 ee/legacy/libraries/Extensions.php(222): Publisher_ext->after_channel_entry_update(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array, Array)
#7 ee/legacy/libraries/Extensions.php(117): EE_Extensions->call_class('Publisher_ext', 'after_channel_e…', Array, Array)
#8 [internal function]: EE_Extensions->call('after_channel_e…', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array, Array)
#9 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(665): call_user_func_array(Array, Array)
#10 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}('after_channel_e…', Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array, Array)
#11 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(616): call_user_func_array(Object(Closure), Array)
#12 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}(Array)
#13 ee/EllisLab/ExpressionEngine/Service/Event/Emitter.php(141): call_user_func_array(Object(Closure), Array)
#14 [internal function]: EllisLab\ExpressionEngine\Service\Event\Emitter->emit('afterUpdate', Array)
#15 ee/EllisLab/ExpressionEngine/Library/Data/Entity.php(654): call_user_func_array(Array, Array)
#16 [internal function]: EllisLab\ExpressionEngine\Library\Data\Entity->emit('afterUpdate', Array)
#17 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(858): call_user_func_array('parent::emit', Array)
#18 ee/EllisLab/ExpressionEngine/Service/Model/Query/Update.php(52): EllisLab\ExpressionEngine\Service\Model\Model->emit('afterUpdate', Array)
#19 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(282): EllisLab\ExpressionEngine\Service\Model\Query\Update->run()
#20 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(248): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#21 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(71): EllisLab\ExpressionEngine\Service\Model\DataStore->updateQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
#22 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(366): EllisLab\ExpressionEngine\Service\Model\Query\Builder->update()
#23 ee/EllisLab/ExpressionEngine/Model/Content/ContentModel.php(225): EllisLab\ExpressionEngine\Service\Model\Model->save()
#24 ee/EllisLab/ExpressionEngine/Controller/Publish/AbstractPublish.php(376): EllisLab\ExpressionEngine\Model\Content\ContentModel->save()
#25 ee/EllisLab/ExpressionEngine/Controller/Publish/Edit.php(527): EllisLab\ExpressionEngine\Controller\Publish\AbstractPublish->saveEntryAndRedirect(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry))
#26 [internal function]: EllisLab\ExpressionEngine\Controller\Publish\Edit->entry('3524')
#27 ee/EllisLab/ExpressionEngine/Core/Core.php(241): call_user_func_array(Array, Array)
#28 ee/EllisLab/ExpressionEngine/Core/Core.php(110): EllisLab\ExpressionEngine\Core\Core->runController(Array)
#29 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
#30 admin.php(153): require_once('...')
#30 admin.php(153): require_once('...')
#1

BoldMinded (Brian)

Dec 11, 2020

What version of php and MySQL are you using?

#2

BoldMinded (Brian)

Dec 11, 2020

Can you also run this query and share the result?

select @@SQL_MODE
#3

BoldMinded (Brian)

Dec 11, 2020

I’m unable to replicate this, so I’m going to need a lot more information from you.

1. Screenshot of the Toggle field’s settings
2. Publisher’s Template Preview settings page (or however you’re defining the preview template)
3. Answers to my previous questions about PHP and MySQL versions, and the result of that query so I know what mode the DB is operating in.
4. Video of this actually happening to ensure I’m re-creating the scenario correctly.

#4

James Brown

Dec 11, 2020

Here’s the environment details.

PHP: 7.3.14-1~deb10u1
MySQL: 5.0.12-dev
SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Let me pull together the other stuff as well.

#5

James Brown

Dec 11, 2020

One other thing I’m thinking of related to this. That particular field was added to the channel after the entry was originally created. So the entry was created and published, then sometime later that field was added. Sometime after that is when I then tried to preview a new draft. Not sure if it is relevant or the actual cause.

#6

BoldMinded (Brian)

Dec 12, 2020

At first I was testing this in EE6, thinking it wouldn’t be any different, but apparently it was. I was able to replicate it in EE5, even though the MySQL versions were the same ¯\_(ツ)_/¯ The next message will have a link to the new build which should fix it. It’ll only throw the error when a field type that has a MySQL column that is of an integer type. The Toggle field saves a 1 or 0, defaulting to 0.

#7

BoldMinded (Brian)

Dec 12, 2020

Comment has been marked private.

#8

BoldMinded (Brian)

Dec 12, 2020

Comment has been marked private.

#9

James Brown

Dec 12, 2020

That seems to have done the trick!

I’m glad you were able to reproduce so that I know I’m not crazy!

Login to reply