Description
When editing an article (or any record that uses Joomla\CMS\Table\Table::checkIn()), clicking Close triggers:
Column 'checked_out' cannot be null
Stack trace excerpt
Joomla\Database\Exception\ExecutionFailureException: Column 'checked_out' cannot be null
#2 /libraries/src/Table/Table.php(1238)
#3 /libraries/src/MVC/Model/FormModel.php(111)
...
Cause
Table::checkIn() builds this SQL:
$nullDate = $this->_supportNullValue ? 'NULL' : $this->_db->quote($this->_db->getNullDate());
$nullID = $this->_supportNullValue ? 'NULL' : '0';
Since _supportNull Value is true in 5.3.x, Joomla issues:
UPDATE #__content
SET checked_out = NULL,
checked_out_time = NULL
However, in the core schema for #__content, both checked_out and checked_out_time are declared NOT NULL DEFAULT 0/0000-00-00 00:00:00,
so strict-mode MySQL rejects the query.
Use Joomla 5.3.4 with a default schema on MySQL 8.0 (strict mode on)
Edit any article
Click Close
Environment
In /libraries/src/Table/Table.php → checkIn(), always use non-NULL safe values:
$nullDate = $this->_db->quote($this->_db->getNullDate());
$nullID = '0';
or guard it conditionally against field definitions.
Patch that line manually or override via a small system plugin.
Labels |
Added:
No Code Attached Yet
|
P.S.: As you can see here, the column allows NULL values in Joomla 5: https://github.com/joomla/joomla-cms/blob/5.4-dev/installation/sql/mysql/extensions.sql#L159-L199 . The database checker does not show that as an error because on Joomla 5 it cannot check the update SQL scripts from Joomla 4 because those are removed by the update from 4 to 5. But you should have seen that error in the database checker when being on 4. Or as said, some 3rd party migration tool messes something up for you.
@RustyIngles Then an update SQL script "4.0.0-2020-05-29.sql" has not been executed when you had updated from Joomla 3 to Joomla 4 in past, because these database columns were changed with Joomla 4. Or you have migrated your data somehow from Joomla 3 to Joomla 4 and the change in the structure was not done or reverted by that mingration.