Locale issues giving HTTP 500 errors

Describe the issue or problem
We’re a large multi-journal site with a long history of upgrades. We’re currently running 3.3.0.20. We have been having intermittent issues with locales and have disabled (or not enabled) several plugins due to apparently locale-related issues.

(a) It does look like we have some minor data corruption in the database (see below) and I’d like some advice fixing that. I’m pretty certain that the NULLs indicate errors and that ““ should be “en_US“

(b) When iterating over many items in the context of user-entered data, themes and templates, it would be great to put a try-catch in the loop. Right now, a single bad article will quite happily shred an OAI-PMH feed with a single 500 error.

See for example https://ojs.victoria.ac.nz/kotare/oai?verb=ListRecords&metadataPrefix=oai_dc which generates the log message:

[13-Oct-2025 03:06:30 UTC] PHP Fatal error: Uncaught TypeError: strip_tags(): Argument #1 ($string) must be of type string, array given in /var/www/ojs/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.inc.php:188
Stack trace:
#0 /var/www/ojs/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.inc.php(188): strip_tags()
#1 /var/www/ojs/lib/pkp/classes/metadata/MetadataDataObjectAdapter.inc.php(266): Dc11SchemaArticleAdapter->extractMetadataFromDataObject()
#2 /var/www/ojs/lib/pkp/classes/filter/Filter.inc.php(449): MetadataDataObjectAdapter->process()
#3 /var/www/ojs/lib/pkp/classes/core/DataObject.inc.php(460): Filter->execute()
#4 /var/www/ojs/lib/pkp/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC.inc.php(22): DataObject->extractMetadata()
#5 /var/www/ojs/plugins/oaiMetadataFormats/dc/OAIMetadataFormat_DC.inc.php(28): PKPOAIMetadataFormat_DC->toXml()
#6 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(790): OAIMetadataFormat_DC->toXml()
#7 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(533): OAI->formatMetadata()
#8 /var/www/ojs/lib/pkp/classes/oai/OAI.inc.php(87): OAI->ListRecords()
#9 /var/www/ojs/pages/oai/OAIHandler.inc.php(39): OAI->execute()
#10 /var/www/ojs/lib/pkp/classes/core/PKPRouter.inc.php(397): OAIHandler->index()
#11 /var/www/ojs/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest()
#12 /var/www/ojs/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route()
#13 /var/www/ojs/lib/pkp/classes/core/PKPApplication.inc.php(360): Dispatcher->dispatch()
#14 /var/www/ojs/index.php(68): PKPApplication->execute()
#15 {main}
thrown in /var/www/ojs/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.inc.php on line 188

What application are you using?
3.3.0.20 on linux connecting to a remote mysql server.

Additional information

Below is a series of queries counting which locales are in use in which tables.

mysql> SELECT locale , COUNT(locale) FROM announcement_type_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 4 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM author_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 27121 |
| en_US | 48552 |
±-------±--------------+
2 rows in set (0.04 sec)

mysql> SELECT locale , COUNT(locale) FROM category_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 7 |
| en_US | 14 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM citation_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 501 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM controlled_vocab_entry_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 1233 |
| en_US | 18244 |
±-------±--------------+
2 rows in set (0.02 sec)

mysql> SELECT locale , COUNT(locale) FROM data_object_tombstone_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 30 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM email_templates_default_data GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| ar_IQ | 8 |
| ca_ES | 26 |
| cs_CZ | 9 |
| da_DK | 28 |
| en_US | 59 |
| es_ES | 28 |
| fr_CA | 18 |
| id_ID | 16 |
| it_IT | 24 |
| pt_BR | 23 |
| pt_PT | 28 |
| ru_RU | 22 |
| sl_SI | 5 |
| sv_SE | 6 |
| tr_TR | 27 |
| vi_VN | 3 |
| zh_CN | 21 |
| de_DE | 31 |
| el_GR | 14 |
| eu_ES | 16 |
| fa_IR | 14 |
| fr_FR | 15 |
| ja_JP | 11 |
| nl_NL | 22 |
| ro_RO | 11 |
| uk_UA | 19 |
| fi_FI | 8 |
| pl_PL | 3 |
| hu_HU | 2 |
| ku_IQ | 2 |
| hr_HR | 1 |
| nb_NO | 1 |
±-------±--------------+
32 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM email_templates_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 24 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM filter_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 21 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM genre_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 216 |
| en_US | 348 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM issue_galley_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 68 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM issue_galleys GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| NULL | 0 |
| en_US | 93 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM issue_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 3186 |
| | 94 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM journal_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 1625 |
| en_US | 874 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM library_file_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 7 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM navigation_menu_item_assignment_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 9 |
±-------±--------------+
1 row in set (0.01 sec)

mysql> SELECT locale , COUNT(locale) FROM navigation_menu_item_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 500 |
| en_US | 44 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM notification_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 9463 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM publication_galley_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 1570 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM publication_galleys GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 7917 |
±-------±--------------+
1 row in set (0.01 sec)

mysql> SELECT locale , COUNT(locale) FROM publication_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 42282 |
| en_US | 38843 |
±-------±--------------+
2 rows in set (0.04 sec)

mysql> SELECT locale , COUNT(locale) FROM review_form_element_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 3 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM review_form_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 2 |
±-------±--------------+
1 row in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM section_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 439 |
| | 3 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM site_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 4 |
| | 7 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM static_page_settings GROUP BY locale;
Empty set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM submission_file_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 18902 |
| | 1844 |
±-------±--------------+
2 rows in set (0.01 sec)

mysql> SELECT locale , COUNT(locale) FROM submission_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 16751 |
| en_US | 1494 |
±-------±--------------+
2 rows in set (0.01 sec)

mysql> SELECT locale , COUNT(locale) FROM submissions GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 8884 |
| NULL | 0 |
±-------±--------------+
2 rows in set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM subscription_type_settings GROUP BY locale;
Empty set (0.00 sec)

mysql> SELECT locale , COUNT(locale) FROM user_group_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| | 993 |
| en_US | 986 |
±-------±--------------+
2 rows in set (0.01 sec)

mysql> SELECT locale , COUNT(locale) FROM user_settings GROUP BY locale;
±-------±--------------+
| locale | COUNT(locale) |
±-------±--------------+
| en_US | 41765 |
| | 1158 |
±-------±--------------+
2 rows in set (0.03 sec)

mysql> SELECT locales , COUNT(locales) FROM users GROUP BY locales;
±--------±---------------+
| locales | COUNT(locales) |
±--------±---------------+
| | 13094 |
±--------±---------------+
1 row in set (0.01 sec)

mysql>
mysql> SELECT installed_locales , COUNT(installed_locales) FROM site GROUP BY installed_locales;
±------------------±-------------------------+
| installed_locales | COUNT(installed_locales) |
±------------------±-------------------------+
| [“en_US”] | 1 |
±------------------±-------------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT supported_locales , COUNT(supported_locales) FROM site GROUP BY supported_locales;
±------------------±-------------------------+
| supported_locales | COUNT(supported_locales) |
±------------------±-------------------------+
| [“en_US”] | 1 |
±------------------±-------------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT primary_locale , COUNT(primary_locale) FROM journals GROUP BY primary_locale;
±---------------±----------------------+
| primary_locale | COUNT(primary_locale) |
±---------------±----------------------+
| en_US | 29 |
±---------------±----------------------+
1 row in set (0.00 sec)

Hi @stuart.yeates,

From the error message you quoted above…

[13-Oct-2025 03:06:30 UTC] PHP Fatal error: Uncaught TypeError: strip_tags(): Argument #1 ($string) must be of type string, array given in /var/www/ojs/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.inc.php:188

…it looks like there is a call to strip_tags in your plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.inc.php file on line 188. However, looking at that file for OJS 3.3.0-20, there aren’t any calls to strip_tags at all. Did you make local modifications to that class?

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you for your feedback Alec!

Investigation suggests that I may have fumbled the plugins directory in our most recent upgrade. I’ll fix that in an upcoming change window and hopefully it’ll fix the issues we’re seeing.

1 Like

Un-fumbling the plugins directory appears to have fixed the issues I was seeing.

Thank you for your help.

1 Like

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