OJS 3.3.0-11: search page not loading in Health Sciences Theme

After successfully upgrading to the most recent OJS version the search page stopped working at the point that the search filters are supposed to be displayed. The full stack trace is below, but the error appears to occur when the Smarty template tries to get the formUrlParameters on this line:

<?php echo parse_str(parse_url($_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'searchFormUrl'),(defined('PHP_URL_QUERY') ? constant('PHP_URL_QUERY') : null)),$_smarty_tpl->tpl_vars['formUrlParameters']->value);?>

We’re using PHP 8.0. I looked through the OJS and Health Sciences GitHub repos for anyone with similar issues, but I haven’t found anything yet. Has anyone else experienced something similar on the search page?

Thanks,
Nick

[Wed Aug 17 13:30:35.889230 2022] [php:error] [pid 10812] [client [ip]:54433] PHP Fatal error: Uncaught Error: Attempt to modify property “value” on null in /ebs/ojs/cache/t_compile/912819d46cd25075eaf3e831e7b7db1fb6a10d5e^756a7119cb48731a8fd45c250b45f4bcca2d6b01_0.app.frontendpagessearch.tpl.php:92\nStack trace:\n#0 /ebs/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_62fbe389149487_88935439(Object(Smarty_Internal_Template))\n#1 /ebs/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))\n#2 /ebs/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))\n#3 /ebs/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 1)\n#4 /ebs/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, ‘912819d46cd2507…’, NULL, 1)\n#5 /ebs/ojs/lib/pkp/classes/template/PKPTemplateManager.inc.php(1187): Smarty_Internal_TemplateBase->display(‘frontend/pages/…’, NULL, ‘912819d46cd2507…’, NULL)\n#6 /ebs/ojs/pages/search/SearchHandler.inc.php(153): PKPTemplateManager->display(‘frontend/pages/…’)\n#7 /ebs/ojs/lib/pkp/classes/core/PKPRouter.inc.php(395): SearchHandler->search(Array, Object(Request))\n#8 /ebs/ojs/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#9 /ebs/ojs/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route(Object(Request))\n#10 /ebs/ojs/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request))\n#11 /ebs/ojs/index.php(68): PKPApplication->execute()\n#12 {main}\n thrown in /ebs/ojs/cache/t_compile/912819d46cd25075eaf3e831e7b7db1fb6a10d5e^756a7119cb48731a8fd45c250b45f4bcca2d6b01_0.app.frontendpagessearch.tpl.php on line 92, referer: [ojs_url]

Hi @nwoodward,

Does the problem persist if clearing template cache (in Site Administration settings)?

Hi @Vitaliy,
Yeah, I tried clearing template cache and even “rm -rf cache/*” in the journal folder just in case, but the problem persists. What’s odd is that I have several journals all using the Default Theme with the same OJS and PHP versions, and search works fine. It’s only the two journals using Health Sciences where we’re seeing the issue.

And if applying this change: https://github.com/pkp/ojs/commit/d876fbc7d0f23caadd8108036f25f7a36218fb26
in plugins/themes/healthSciences/templates/frontend/pages/search.tpl (add as line 62), does it solve the issue?

That’s it! I saw that change to the default search template a while ago, but didn’t put it together that Health Sciences overrides that template. It also needs to set formUrlParameters to an empty array, and after I added that line the search form works again. FWIW, it looks like the Classic, Immersion and Pragma themes are also missing that change in their search.tpl files.

Thanks, I’ll fix it.

You are likely using PHP 8.1 for this OJS instance as that error is a compatibility problem which is relevant starting from 8.1.0

Hmmm. AWS doesn’t offer 8.1 for Amazon Linux 2 yet, so I’m sure I’m using 8.0. Thank you so much for your help.

[ojs@localhost ~]# php --version
PHP 8.0.20 (cli) (built: Jun 23 2022 20:34:07) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.20, Copyright (c) Zend Technologies
with Zend OPcache v8.0.20, Copyright (c), by Zend Technologies

This is CLI version. You can check what your web server is using, e.g., by looking at the site’s Administration → System information

@Vitaliy If you have any tips/suggestions … I’m all ears. I updated the code in immersion, healthSciences, and the classic themes… they work running locally (with php7.4 and php8.0)… so, not sure why the tests are failing under Travis/Cypress. Also, the issues that these reference are from me as well. We see the same result that nwoodward does that there is a fatal error under php 8.0, without these updates.