Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

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: Integrity constraint violation: 1048 Column ‘expiration_date’ cannot be null

Status Resolved
Add-on / Version Publisher Lite 3.1.2
Severity
EE Version 5.3.0

Hop Studios

Feb 12, 2020

Hello Brian,

Got another one. When I save after installing Publisher, I got the following error:

Exception Caught
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'expiration_date' cannot be null:
UPDATE `exp_channel_titles` SET `title` = 'Contract Studio Model', `url_title` = 'contract-studio-model-for-anatomy-drawing-class', `entry_date` = 1563580440, `expiration_date` = NULL, `comment_expiration_date` = NULL WHERE `entry_id` = 7250
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(547): CI_DB_active_record->update('channel_titles', Array)
#5 user/addons/publisher/ext.publisher.php(565): 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)

My fix for this is in Service/Entry/Entry.php @ line 540:

$db
            ->where('entry_id', $entryId)
            ->update('channel_titles', [
                'title' => $defaultData['title'],
                'url_title' => $defaultData['url_title'],
                'entry_date' => $defaultData['entry_date'],
                'expiration_date' => $defaultData['expiration_date'] || '',
                'comment_expiration_date' => $defaultData['comment_expiration_date'] || '',
            ]);

expiration_date and comment_expiration_date are not required. When I dump the $defaultData I do get the expiration_date as key but the value is just blank/null.

#1

BoldMinded (Brian)

The default value should be an integer actually, so changing that to || 0 would be a better fix. I’ll make this change for the next release. Thanks for pointing it out.

Login to reply