Errors when updating OJS 3.1.2.4 to 3.3.0.6

Hello,

I’m currently trying to update the journals I’m managing to 3.3.0.6.
On one particular journal, which was version 3.1.2.4 before, I can’t start the online Installation, as the page is not shown. The error log shows the following error:

[Tue May 11 12:52:12.587380 2021] [php7:error] [pid 13703] [client 132.199.243.39:50408] PHP Fatal error:  Uncaught Error: Call to a member function getConnection() on null in /var/www/ojs_pf/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php:74
Stack trace:
#0 /var/www/ojs_pf/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php(200): Illuminate\\Database\\Capsule\\Manager::connection()
#1 /var/www/ojs_pf/lib/pkp/classes/db/DAO.inc.php(65): Illuminate\\Database\\Capsule\\Manager::__callStatic('raw', Array)
#2 /var/www/ojs_pf/lib/pkp/classes/context/ContextDAO.inc.php(63): DAO->retrieve('SELECT * FROM j...', Array)
#3 /var/www/ojs_pf/lib/pkp/classes/core/PKPRouter.inc.php(252): ContextDAO->getByPath('pf')
#4 /var/www/ojs_pf/lib/pkp/classes/core/PKPRequest.inc.php(760): PKPRouter->getContext(Object(Request), 1)
#5 /var/www/ojs_pf/classes/core/Request.inc.php(64): PKPRequest->_delegateToRouter('getContext', 1)
#6 /var/www/ojs_pf/lib/pkp/classes/template/PKPTemplateManager.inc.php(114): Request->getContext()
#7 /var/www/ojs_pf/classes/template/TemplateManager.inc.php in /var/www/ojs_pf/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Database/Capsule/Manager.php on line 74

This seems to be a duplicate of: Unable to upgrade 3.3.0.2: Call to a member function getConnection() on null · Issue #6703 · pkp/pkp-lib · GitHub which should have been solved in 3.3.0.5

Any ideas what could be the problem here?
Thanks!

Hi @KBodarwe

Can you confirm that you have the fix for the previously reported bug in your code:

It should just be the line with the + sign in front of it, around line 36 in the file referenced in the commit.

If it’s there, then we can consider other things.

Cheers,
Jason

Hi @jnugent ,
yes I can confirm that fix is present in the code.

Cheers,
Karl.

Hi Karl,

Have you tried running the update from the command line instead of the online way?

php tools/upgrade.php upgrade

my understanding is the previous bug was only present in the online version.

If you just want to see if the database connection component works you can run

php tools/upgrade.php check

Which still needs to connect to the database first.

Cheers,
Jason

Hello Jason,

Updating from the command line fails, throwing the following error:

ERROR: Upgrade failed: DB: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'review_round_id' at row 10 (SQL: ALTER TABLE review_assignments CHANGE review_round_id review_round_id BIGINT NOT NULL)

Also several of these errors were thrown throughout the process, before it was canceled:

PHP Notice:  unserialize(): Error at offset 245 of 3730 bytes in /var/www/ojs_pf/lib/pkp/classes/db/DAO.inc.php on line 252

running the check from the command line first brought the following results:

Code version:      3.3.0.6
Database version:  3.1.2.4
Latest version:    3.3.0.6
Database version is older than code version
Run "tools/upgrade.php upgrade" to update

Any idea what could have gone wrong?

Thanks!

Hi @KBodarwe

Off the top of my head, it sounds like you might have some invalid values in the review_assignments table, for the review_round_id column. MySQL is telling you that it tried to convert that column to a “bigint not null” column and found some data that no longer fit. You should to review the review assignments table. A review round id should not be null, for example, and it should be a valid integer.

Cheers,
Jason

1 Like

Hello Jason,
this seems to have been the problem.
After resetting the database to a backup, I ran:

update review_assignments SET review_round_id = 0 WHERE review_round_id IS NULL;

And afterwards the Command Line Update tool ran without breaking.
The update seems to have run.
Thanks for your help!

1 Like

Great, glad to hear it!