Error while upgrading from 3.3.0-14 to 3.3.0-19

When running the upgrade check we are getting the following PHP error:

php tools/upgrade.php check
PHP Fatal error: Uncaught Error: Undefined constant “SCHEMA_GALLEY” in /var/www/ojs-3.3.0-19/lib/pkp/includes/functions.inc.php:224
Stack trace:
#0 /var/www/ojs-3.3.0-19/lib/pkp/classes/db/DAORegistry.inc.php(67): instantiate()
#1 /var/www/ojs-3.3.0-19/classes/oai/ojs/OAIDAO.inc.php(41): DAORegistry::getDAO()
#2 /var/www/ojs-3.3.0-19/plugins/generic/driver/DRIVERPlugin.inc.php(33): OAIDAO->__construct()
#3 /var/www/ojs-3.3.0-19/lib/pkp/classes/plugins/PluginRegistry.inc.php(69): DRIVERPlugin->register()
#4 /var/www/ojs-3.3.0-19/lib/pkp/classes/plugins/PluginRegistry.inc.php(142): PluginRegistry::register()
#5 /var/www/ojs-3.3.0-19/lib/pkp/classes/cliTool/CliTool.inc.php(65): PluginRegistry::loadCategory()
#6 /var/www/ojs-3.3.0-19/lib/pkp/classes/cliTool/UpgradeTool.inc.php(36): CommandLineTool->__construct()
#7 /var/www/ojs-3.3.0-19/tools/upgrade.php(21): UpgradeTool->__construct()
#8 {main}
thrown in /var/www/ojs-3.3.0-19/lib/pkp/includes/functions.inc.php on line 224

We are running PHP version 8.0.30.
Has anyone run into this error and can you gives us an solution to try?

Add the following line to the /var/www/ojs/tools/upgrade.php ****

import(‘lib.pkp.classes.services.PKPSchemaService’); // SCHEMA_ constants (towards the top of the file below the other import statements)

1 Like

Thanks @wcollins, I will pass it along.

I can confirm this worked.

I can confirm this error. The key, I think, is that we’re upgrading with PHP 8 for the first time.

OJS 3.3.0.21
PHP 8.2.x

@Vitaliy fixed a similar error in 2020: Undefined const SCHEMA_PUBLICATION during upgrade · Issue #6000 · pkp/pkp-lib · GitHub.
Except in this instance the undefined constant is “SCHEMA_GALLEY” rather than “SCHEMA_PUBLICATION”. This latest error also affects upgrade, not only the check test. It seems to be effectively breaking upgrade with PHP 8.

Adding import('lib.pkp.classes.services.PKPSchemaService'); to tools/upgrade.php is a successful workaround, but is there a better upstream solution?

Thank you!

Richard Higgins
Indiana University Libraries

Hi @Richard-Higgins,

That’s a perfectly valid solution; would you mind opening a pull request to suggest the change in github?

Thanks,
Alec Smecher
Public Knowledge Project Team

Thanks, @asmecher! I’ll create a PR.

Richard