Error when upgrading OJS on php8

Description of issue or problem I’m having:
When running the upgrade database script we get the following output an error message Call to undefined function get_magic_quotes_runtime() error:

We believe this may be because the get_magic_quotes_runtime() was removed in php8 and we are running php 8.0.10. The download page states requirements is php greater than 7.3, so we thought php 8 satisfied that requirement. Did we miss something when updating from git, or is upgrading the database not supported when using php 8 yet?

Steps I took leading up to the issue:

php tools/upgrade.php upgrade

What I tried to resolve the issue:

Application Version - e.g., OJS 3.1.2:
We are upgrading to version 3.3.0.9 from 3.1.1

Additional information, such as screenshots and error log messages if applicable:

[pre-install]
[load: upgrade.xml]
[version: 3.3.0.8]
[code: Installer Installer::checkPhpVersion]
[data: dbscripts/xml/upgrade/3.1.2_preupdate_user_author_names.xml]
[code: Installer Installer::migrateSubmissionCoverImages]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_email_templates.xml]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning_articleGalleySettings.xml (skipped)]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_versioning.xml]
[data: dbscripts/xml/upgrade/3.2.0_preupdate_last_activity.xml]
[schema: lib/pkp/xml/schema/common.xml]
PHP Fatal error:  Uncaught Error: Call to undefined function get_magic_quotes_runtime() in /var/www/ojs/lib/pkp/lib/vendor/adodb/adodb-php/adodb-xmlschema.inc.php:1307
Stack trace:
#0 /var/www/ojs/lib/pkp/classes/install/Installer.inc.php(364): adoSchema->__construct()
#1 /var/www/ojs/lib/pkp/classes/install/Installer.inc.php(251): Installer->executeAction()
#2 /var/www/ojs/lib/pkp/classes/install/Installer.inc.php(174): Installer->executeInstaller()
#3 /var/www/ojs/lib/pkp/classes/cliTool/UpgradeTool.inc.php(89): Installer->execute()
#4 /var/www/ojs/lib/pkp/classes/cliTool/UpgradeTool.inc.php(65): UpgradeTool->upgrade()
#5 /var/www/ojs/tools/upgrade.php(22): UpgradeTool->execute()
#6 {main}
  thrown in /var/www/ojs/lib/pkp/lib/vendor/adodb/adodb-php/adodb-xmlschema.inc.php on line 1307

We missed the

composer --working-dir=lib/pkp update

https://docs.pkp.sfu.ca/dev/documentation/en/getting-started#updates

@OyvindLGjesdal, does that mean you were able to upgrade successfully when you updated the composer dependencies first? That’s good news.

I’ve filed a bug here, but I can close that if updating the dependencies resolved the error for you.

No you are correct @NateWr, the error still stands. We got other error messages which I assumed meant the first error was gone, but I think it was just because the database upgrade was in a “broken” state. After I did a restore of the database, the error turned up again.

Hi all,

Thanks, @OyvindLGjesdal and @NateWr! Please continue the discussion (and see a proposed fix) at the Github link: Can't upgrade to 3.2.x on PHP 8 due to use of get_magic_quotes_runtime · Issue #7275 · pkp/pkp-lib · GitHub

Regards,
Alec Smecher
Public Knowledge Project Team