OJS upgrade from 3.2.0-4 to 3.5.0-0 error

Hi,

I just tried upgrade on 3.2.0-4 to 3.5.0-0 and got this:

$ php8.2 tools/upgrade.php upgrade
2025-06-26 13:37:55 [pre-install]
2025-06-26 13:37:55 [load: upgrade.xml]
2025-06-26 13:37:55 [version: 3.5.0.0]
2025-06-26 13:37:55 [code: Installer Installer::checkPhpVersion]
2025-06-26 13:37:55 [code: Installer Installer::abort]
ERROR: Upgrade failed: Upgrade unsupported. See the Upgrade Guide (https://docs.pkp.sfu.ca/dev/upgrade-guide) for details.

Does this mean that upgrading from 3.2 to 3.5 is not possible?

Regards.

Hi @orcalator,

Direct upgrades from 3.2.x or older directly to 3.5.0 or newer are not supported.

To upgrade to a newer release from 3.2.0-x or older, you’ll need to upgrade first to either 3.3.0-x or 3.4.0-x. Both pathways are supported.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Thank you for info, so i’m back to where we stopped last time and that was here:

Not sure what will i do.

Regards.

Hi @orcalator,

I thought you had a good route forward with an upgrade from 3.2.0-4 to the latest 3.3.0-x. From there, you can upgrade directly to 3.5.0-x. Does that route work? If not, what problem are you running into?

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 11 days. New replies are no longer allowed.

Hi @asmecher,

Unfortunately, it’s not working :frowning: I just tried upgrading to the 3.3.0-20 and the upgrade ends with:

2025-07-10 17:41:58 [migration: OJSv3_3_0UpgradeMigration]
PHP Warning:  Undefined property: stdClass::$locale in /var/www-data/ojs-3.3.0-20/classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php on line 191
ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'locale' in 'WHERE' (SQL: update `event_log_settings` set `setting_value` = {} where `setting_name` = originalFileName and `locale` is null and `log_id` = 51166)

I described this problem here: OJS upgrade error on event_log_settings table, locale field. You advised me to do a clean install but that didn’t help. This same thing happens with 3.3.0-18, 3.3.0-19 and 3.4.x version if i remember correctly. Only version i found to be working is 3.3.0-17 but there is a big problem with that version described here: OJS review form settings get deleted/overwritten on upgrade from 3.2 to 3.3. There is some patch for that version but i’d really like not to do that. Can you help me to solve this, i’ve been fighting with it for almost 2 months now :frowning: Thank you.

Regards

Ok, it seems i finally found solution. In:

classes/migration/upgrade/OJSv3_3_0UpgradeMigration.inc.php

i added some code to the _toJSON function so now function looks like this:

    private function _toJSON($row, $tableName, $searchBy, $valueToConvert)
    {
            // Check if value can be unserialized
            $serializedOldValue = $row->{$valueToConvert};
            if (@unserialize($serializedOldValue) === false) return;
            $oldValue = unserialize($serializedOldValue);

            // Reset arrays to avoid keys being mixed up
            if (is_array($oldValue) && $this->_isNumerical($oldValue)) $oldValue = array_values($oldValue);
            $newValue = json_encode($oldValue, JSON_UNESCAPED_UNICODE); // don't convert utf-8 characters to unicode escaped code

            // Ensure ID fields are included on the filter to avoid updating similar rows
            $tableDetails = Capsule::connection()->getDoctrineSchemaManager()->listTableDetails($tableName);
            $primaryKeys = [];
            try {
                    $primaryKeys = $tableDetails->getPrimaryKeyColumns();
            } catch (Exception $e) {
                    foreach ($tableDetails->getIndexes() as $index) {
                                    if($index->isPrimary() || $index->isUnique()) {
                                            $primaryKeys = $index->getColumns();
                                            break;
                                    }
                            }
            }

            if (!count($primaryKeys)) {
                    foreach (array_keys(get_object_vars($row)) as $column) {
                            if (substr($column, -3) ==  '_id') {
                                    $primaryKeys[] = $column;
                            }
                    }
            }

            $searchBy = array_merge($searchBy, $primaryKeys);

            $queryBuilder = Capsule::table($tableName);
            foreach (array_unique($searchBy) as $column) {
                    if (!property_exists($row, $column)) {
                        continue;
                    }
                    if ($row->{$column} !== null) {
                            $queryBuilder->where($column, $row->{$column});
                    } else {
                            $queryBuilder->whereNull($column);
                    }
            }
            $queryBuilder->update([$valueToConvert => $newValue]);
    }

the change is in the foreach loop where i added this:

                    if (!property_exists($row, $column)) {
                        continue;
                    }

After this change upgrade to 3.3.0-20 went smoothly.

Regards.