NULL in locale metadata 3.5.0.5

Describe the issue or problem
We have more than a decade of history on OJS and more than 20 journals on a single instance; we may have some data hygiene issues. I’ve been chasing my tail to find and fix errors which appear to be data errors related to locale fields.

The error I’m seeing is:

[20-Aug-2026 21:50:52 UTC] Plugin APP\plugins\generic\dublinCoreMeta\DublinCoreMetaPlugin failed to handle the hook ArticleHandler::view
TypeError: PKP\i18n\LocaleConversion::toBcp47(): Argument #1 ($locale) must be of type string, null given, called in /var/www/ojs/plugins/generic/dublinCoreMeta/DublinCoreMetaPlugin.php on line 159 and defined in /var/www/ojs/lib/pkp/classes/i18n/LocaleConversion.php:205
Stack trace:
#0 /var/www/ojs/plugins/generic/dublinCoreMeta/DublinCoreMetaPlugin.php(159): PKP\i18n\LocaleConversion::toBcp47(NULL)
#1 [internal function]: APP\plugins\generic\dublinCoreMeta\DublinCoreMetaPlugin->articleView(‘ArticleHandler:…’, Array)
#2 /var/www/ojs/lib/pkp/classes/plugins/Hook.php(164): call_user_func_array(Object(Closure), Array)
#3 /var/www/ojs/lib/pkp/classes/plugins/Hook.php(132): PKP\plugins\Hook::run(‘ArticleHandler:…’, Array)
#4 /var/www/ojs/pages/article/ArticleHandler.php(364): PKP\plugins\Hook::call(‘ArticleHandler:…’, Array)
#5 [internal function]: APP\pages\article\ArticleHandler->view(Array, Object(APP\core\Request))
#6 /var/www/ojs/lib/pkp/classes/core/PKPRouter.php(327): call_user_func(Array, Array, Object(APP\core\Request))
#7 /var/www/ojs/lib/pkp/classes/core/PKPPageRouter.php(249): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array, false)
#8 /var/www/ojs/lib/pkp/classes/core/Dispatcher.php(157): PKP\core\PKPPageRouter->route(Object(APP\core\Request))
#9 /var/www/ojs/lib/pkp/classes/core/PKPApplication.php(429): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#10 /var/www/ojs/index.php(21): PKP\core\PKPApplication->execute()
#11 {main}

If someone can tell me which table the offending NULL is likely to be in, I should be able to write and share SQL code to fix it.

Looking through the database schema various of locale-related fields I see:

grep "`locale` " ojs-sql-dev-new.sql | sort | uniq -c | sort -n
1 locale varchar(28) DEFAULT ‘en_US’,
1 locale varchar(28) DEFAULT NULL COMMENT ‘Locale key.’,
1 locale varchar(28) NOT NULL,
1 locale varchar(28) NOT NULL DEFAULT ‘en’,
4 locale varchar(28) DEFAULT NULL,
44 locale varchar(28) NOT NULL DEFAULT ‘’,

grep "`language` " ojs-sql-dev-new.sql | sort | uniq -c | sort -n
1 language varchar(10) DEFAULT ‘en’,
1 language varchar(10) NOT NULL DEFAULT ‘en’,

The software engineer in me cries out in horror at this inconsistency; while it continues we will inevitably reap a rich harvest of bugs.

Steps I took leading up to the issue
For example:

  1. I run wget -r --level=10 https://ojs-dev.victoria.ac.nz/ --wait=10 to click very link looking for errors. (Doesn’t check links only reached via javascript)
  2. Look in the logs for errors
  3. See error above, numerous times
  4. Be unable to work out which database table is likely to contain the offending NULL

What application are you using?
For example, OJS 3.5.0.5

Additional information
Please add any screenshots, logs or other information we can use to investigate this problem.

For others in a similar situation, we have improved and number of related errors using the SQL commands:

update issue_galleys set locale = ‘en’ where locale IS NULL;

update publication_settings set setting_value = ‘’ where setting_name = ‘pub-id::publisher-id’ AND setting_value IS NULL;

UPDATE author_settings SET locale = “en” WHERE setting_name = “familyName” AND locale = “”;
UPDATE author_settings SET locale = “en” WHERE setting_name = givenName" AND locale = “”;

It doesn’t solve all this issues, however, and our search continues…