[OJS-3.5] after PHP upgrade, non-logged in sections of site appear unstyled: Locale::setDefault() error in DefaultThemePlugin

Describe the issue or problem
When our journal went back online after the upgrade to PHP-8.5.12, the homepage (and all non-logged in sections) are appearing unstyled. After logging in, everything is looking fine, though.

Yet, no errors or warnings about failed CSS requests are being logged in the browser’s development console.

I’m not sure if it is related to this issue, but the OJS logs do show a theme-related error, though:

[Tue Oct 27 10:50:12.553201 2026] [php:notice] [pid 12:tid 12] [client 172.20.0.22:34646] Plugin APP\\plugins\\themes\\default\\DefaultThemePlugin failed to handle the hook PluginRegistry::categoryLoaded::themes
TypeError: Locale::setDefault(): Argument #1 ($locale) must be of type string, null given in /var/www/html/lib/pkp/classes/i18n/Locale.php:163
Stack trace:
#0 /var/www/html/lib/pkp/classes/i18n/Locale.php(163): Locale::setDefault()
#1 /var/www/html/lib/pkp/classes/i18n/Locale.php(143): PKP\\i18n\\Locale->setLocale()
#2 /var/www/html/lib/pkp/classes/i18n/Locale.php(475): PKP\\i18n\\Locale->getLocale()
#3 /var/www/html/lib/pkp/classes/i18n/Locale.php(114): PKP\\i18n\\Locale->translate()
#4 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(996): PKP\\i18n\\Locale->get()
#5 /var/www/html/lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(1028): trans()
#6 /var/www/html/plugins/themes/default/DefaultThemePlugin.php(45): __()
#7 /var/www/html/lib/pkp/classes/plugins/ThemePlugin.php(131): APP\\plugins\\themes\\default\\DefaultThemePlugin->init()
#8 [internal function]: PKP\\plugins\\ThemePlugin->themeRegistered()
#9 /var/www/html/lib/pkp/classes/plugins/Hook.php(164): call_user_func_array()
#10 /var/www/html/lib/pkp/classes/plugins/Hook.php(132): PKP\\plugins\\Hook::run()
#11 /var/www/html/lib/pkp/classes/plugins/PluginRegistry.php(143): PKP\\plugins\\Hook::call()
#12 /var/www/html/lib/pkp/classes/template/PKPTemplateManager.php(1575): PKP\\plugins\\PluginRegistry::loadCategory()
#13 /var/www/html/lib/pkp/classes/plugins/Plugin.php(396): PKP\\template\\PKPTemplateManager::getManager()
#14 /var/www/html/lib/pkp/classes/plugins/Plugin.php(134): PKP\\plugins\\Plugin->_registerTemplateResource()
#15 /var/www/html/lib/pkp/classes/plugins/LazyLoadPlugin.php(34): PKP\\plugins\\Plugin->register()
#16 /var/www/html/plugins/generic/webFeed/WebFeedPlugin.php(37): PKP\\plugins\\LazyLoadPlugin->register()
#17 /var/www/html/lib/pkp/classes/plugins/PluginRegistry.php(84): APP\\plugins\\generic\\webFeed\\WebFeedPlugin->register()
#18 /var/www/html/lib/pkp/classes/plugins/PluginRegistry.php(136): PKP\\plugins\\PluginRegistry::register()
#19 [internal function]: PKP\\plugins\\PluginRegistry::{closure:PKP\\plugins\\PluginRegistry::loadCategory():136}()
#20 /var/www/html/lib/pkp/classes/plugins/PluginRegistry.php(136): array_walk_recursive()
#21 /var/www/html/lib/pkp/classes/core/Dispatcher.php(147): PKP\\plugins\\PluginRegistry::loadCategory()
#22 /var/www/html/lib/pkp/classes/core/PKPApplication.php(429): PKP\\core\\Dispatcher->dispatch()
#23 /var/www/html/index.php(21): PKP\\core\\PKPApplication->execute()
#24 {main}, referer: https://journal.com/index.php/index/login?source=%2Findex.php%2Findex%2Fadmin
172.20.0.22 - - [27/Oct/2026:10:50:12 +0000] "GET /index.php/journal HTTP/1.1" 200 2486 "https://journal.com/index.php/index/login?source=%2Findex.php%2Findex%2Fadmin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:158.0) Gecko/20100101 Firefox/158.0"

Steps I took leading up to the issue
For example:

  1. upgrade PHP to 8.5.12
  2. restart OJS
  3. load homepage in browser
  4. see how homepage loads, but doesn’t have any CSS styling

What application are you using?
OJS 3.5.0-5

Additional information
I’ve found this GitHub issue Locale::lookup() receives more than 100 language tags and causes TypeError on PHP 8.4 · Issue #13139 · pkp/pkp-lib · GitHub , that seemed quite similar but should have been fixed.

Could it be that an upgrade to PHP-8.5.12 caused a difference in the treatment of locales that should be fixed in OJS?

Ok, just found this related topic: Theme CSS not loaded in OPS 3.5.0-5 — Locale::lookup() fails when und is in the candidate list - #2 by asmecher, which describes exactly the same problem, with a link to the GitHub issue I mentioned in my initial post.

When skimming it earlier today, I hadn’t noticed the PR had not yet landed in OJS-3.0.5-5 but is scheduled for OJS-3.0.5-6.

I’ve patched the /lib/pkp/classes/i18n/Locale.php file locally with the version from the PR at pkp/pkp-lib#13139 Fix Locale::lookup() canonicalization failure crash… by bozana · Pull Request #13165 · pkp/pkp-lib · GitHub, and can confirm this fixes the issue!

Thank you very much for this, fixed my problem too.