?
avatar Quy
Quy
27 Mar 2021

Steps to reproduce the issue

Create a new article.
Click Save button.
Edit article.
Click Save button.
Edit article.
Click Versions button.
Click on a version.
Click Restore button.

Actual result

Column 'state' cannot be null

avatar Quy Quy - open - 27 Mar 2021
avatar joomla-cms-bot joomla-cms-bot - change - 27 Mar 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Mar 2021
avatar Quy Quy - change - 27 Mar 2021
The description was changed
avatar Quy Quy - edited - 27 Mar 2021
avatar brianteeman
brianteeman - comment - 27 Mar 2021

is this with workflow enabled?

avatar Quy
Quy - comment - 27 Mar 2021

Yes. However, when workflow is disabled, there is a different message.

Column 'ordering' cannot be null

avatar brianteeman
brianteeman - comment - 27 Mar 2021

there is a release blocker for versions and workflow

avatar Quy Quy - change - 27 Mar 2021
The description was changed
avatar Quy Quy - edited - 27 Mar 2021
avatar PhilETaylor
PhilETaylor - comment - 27 Mar 2021

Confirmed. Can you confirm this was tested in PHP 8?
Screenshot 2021-03-27 at 18 20 39

avatar Quy
Quy - comment - 27 Mar 2021

PHP 7.4.9

avatar PhilETaylor
PhilETaylor - comment - 27 Mar 2021

Please confirm your CANT restore the original version but your CAN restore subsequent versions

avatar Quy
Quy - comment - 27 Mar 2021

I can restore versions except for the last one listed.

avatar PhilETaylor
PhilETaylor - comment - 27 Mar 2021

The "last one listed" is "the first version created when you first create the article"... when the ordering is 0 in the db...

avatar Quy
Quy - comment - 27 Mar 2021

I confirm your assessment.

avatar Quy Quy - change - 27 Mar 2021
Title
[4.0] Column 'state' cannot be null in Versions > Restore
[4.0] Column 'ordering' cannot be null when restoring original version
avatar Quy Quy - edited - 27 Mar 2021
avatar PhilETaylor
PhilETaylor - comment - 27 Mar 2021

trying to restore the original version of a Category gives other null warnings

Screenshot 2021-03-27 at 19 01 49

avatar PhilETaylor
PhilETaylor - comment - 27 Mar 2021

Ive debugged this but now Im in a loop and I cannot fight my way out, it seems that "ordering" on an Article being inserted to the db gets coverted from a 0 to NULL deep in the process for updating the assets tables.. in libraries/src/Table/Nested.php there is

$oldDispatcher = clone $this->getDispatcher();
		$blankDispatcher = new Dispatcher;
		$this->setDispatcher($blankDispatcher);

		$result = parent::store($updateNulls);

		// Restore previous callable dispatcher state:
		$this->setDispatcher($oldDispatcher);

Before the store parent::store($updateNulls), the ordering is 0 and after the store its NULL, which is then passed the the versioning plugin using the onTableAfterStore event...

So the data being saved in the JSON. in the versions table is containing the nulls, so when you try to restore it you get the error messages.

avatar joomdonation
joomdonation - comment - 30 Mar 2021

PR #32890 should fix the issue for both category and article. I don't know how workflow works, so I don't set default value for state field to avoid it causes un-expected behavior. For workflow enabled, maybe a different PR would be needed.

avatar Quy Quy - change - 1 Apr 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-04-01 16:31:16
Closed_By Quy
avatar Quy Quy - close - 1 Apr 2021
avatar Quy
Quy - comment - 1 Apr 2021

Thanks!

avatar PhilETaylor
PhilETaylor - comment - 1 Apr 2021

Correct PR number is #32932

Add a Comment

Login with GitHub to post a comment