Describe the issue or problem
Our OJS deployment was recently upgraded from 3.1.1.0 to 3.3.0.13. When we try to edit a newly created user (after the upgrade) the website responds with ‘Failed Ajax request or invalid JSON returned.’. All the users previously created on before the upgrade can be edited without an issue.
What application are you using?
OJS 3.3.0.13
PHP 8.0.27
Database: PostgreSQL 15.1
OS: Ubuntu 22.04
Additional information
http server log reports the following error:
[Thu Jan 19 19:08:38.361395 2023] [php:error] [pid 1269] [client 127.0.0.1:50506] PHP Fatal error: Uncaught TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in /srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php:39
Stack trace:
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php(39): htmlspecialchars()
/srv/hosting/domain.org/lib/pkp/classes/template/PKPTemplateManager.inc.php(1784): smarty_modifier_escape()
/srv/hosting/domain.org/cache/t_compile/2122dd4b4d038d06701b7a5cbc73d21546ea835d_0.app.formtextInput.tpl.php(125): PKPTemplateManager->smartyEscape()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_63c96616b2a031_79831576()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()
/srv/hosting/domain.org/lib/pkp/classes/form/FormBuilderVocabulary.inc.php(434): Smarty_Internal_TemplateBase->fetch()
/srv/hosting/domain.org/lib/pkp/classes/form/FormBuilderVocabulary.inc.php(288): FormBuilderVocabulary->_smartyFBVTextInput()
/srv/hosting/domain.org/cache/t_compile/e688bd52a60a2f40254f746518d02cb6c45d5a61^e565cf5500e8246b7982cbf0654d2bdb3bbd22b6_0.app.commonuserDetails.tpl.php(369): FormBuilderVocabulary->smartyFBVElement()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_63c96625bdaac7_61714098()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(385): Smarty_Internal_Template->render()
/srv/hosting/domain.org/cache/t_compile/e688bd52a60a2f40254f746518d02cb6c45d5a61^8556fb23e7fb57ad227780d4140a6e81b73ea93a_0.app.controllersgridsettingsus.php(71): Smarty_Internal_Template->_subTemplateRender()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_63c96625b87584_74959646()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render()
/srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute()
/srv/hosting/domain.org/lib/pkp/classes/template/PKPTemplateManager.inc.php(1072): Smarty_Internal_TemplateBase->fetch()
/srv/hosting/domain.org/lib/pkp/classes/form/Form.inc.php(197): PKPTemplateManager->fetch()
/srv/hosting/domain.org/lib/pkp/controllers/grid/settings/user/form/UserForm.inc.php(83): Form->fetch()
/srv/hosting/domain.org/lib/pkp/controllers/grid/settings/user/form/UserDetailsForm.inc.php(192): UserForm->display()
/srv/hosting/domain.org/lib/pkp/controllers/grid/settings/user/UserGridHandler.inc.php(287): UserDetailsForm->display()
/srv/hosting/domain.org/lib/pkp/classes/core/PKPRouter.inc.php(395): UserGridHandler->editUser()
/srv/hosting/domain.org/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest()
/srv/hosting/domain.org/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPComponentRouter->route()
/srv/hosting/domain.org/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch()
/srv/hosting/domain.org/index.php(68): PKPApplication->execute()
{main}
thrown in /srv/hosting/domain.org/lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php on line 39, referer: https://domain.org/index.php/scpe/management/settings/access
I have checked the http call triggered when the user edit popup should show up:
and for the users created after the upgrade it returns an HTML content but for the users previously created it is a JSON content (and the HTML is embedded in the JSON).
Now, the HTML content is not rendered successfully because it suddenly ends with:
<div class="inline pkp_helpers_threeQuarter">
<input type="text"
class="field text"
name="affiliation[en_US]"
value="
I’ve checked the database, user_settings
table and the affiliation
setting_value of type object
with value:
{"en_US":"The Institute of Something"}
Previously created users have this entry of type string
.
I think this might be the issue but I don’t know what to do further. Any help would be appreciated.
Thanks,
Silviu.