[OJS 3.2.1.1] danielstjules/stringy/src/Stringy.php error

Hi, we just upgraded to OJS 3.2.1.1 on many different journals
most of the installations worked however for our largest isntallation we are getting the following error when we are in the dashboard and try to access any submission active/archive etc. Are we going to have to try to re-install?

PHP Fatal error: Uncaught InvalidArgumentException: Passed value cannot be an array in /lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php:45
Stack trace:

#0 /lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php(73): Stringy\Stringy->__construct(Array, NULL)
#1 /lib/pkp/classes/core/PKPString.inc.php(170): Stringy\Stringy::create(Array)
#2 /plugins/pubIds/doi/DOIPubIdPlugin.inc.php(408): PKPString::strtolower(Array)
#3 /lib/pkp/classes/plugins/HookRegistry.inc.php(107): DOIPubIdPlugin->addPublicationFormFields(‘Form::config::b…’, Object(PKP\components\forms\publication\PKPPublicationIdentifiersForm))
#4 /lib/pkp/classes/components/forms/FormComponent.inc.php(247): HookRegistry::call(‘Form::config::b…’, Object(PKP\components\forms\publication\PKPPublicationIdentifiersForm))
#5 /lib/pkp/pages/workflow/PKPWorkflowHandler.inc.php(393): PKP\components\forms\FormComponent->getConfig()
#6 in /lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php on line 45

Just an update. We found when disabling the DOI plugin we can then click on the submission link.

Hi @jhennig,

Could you check your database and ensure that there’s a valid-looking primary_locale for every entry in the journals table?

Regards,
Alec Smecher
Public Knowledge Project Team

Yes. There is only 1 entry in the journals table. The primary Locale is en_US

Jeremy

Hi @jhennig,

Can you check your journal_settings table for unusual entries with setting_name='acronym', e.g. multiple entries with the same locale for the same journal (journal_id)?

Regards,
Alec Smecher
Public Knowledge Project Team

Anytime there is a duplicate setting they have difference locale’s. There is 1 oddity where “navItems” has 3 entries, other entries are only duplicated.
The navItems locals are en_US, en_CC and blank. Should I remove the blank one? it’s value is just N;

What is the link to DOI’s? when the DOI plugin is disabled everything works fine.

Hi @jhennig,

I’m not sure where a locale value of en_CC would have come from – we’ve never used that locale code. But I don’t think it’s causing the problem you’re seeing.

The navItems settings are from OJS 2.x and are no longer used – you can remove or ignore them as you like.

I’d suggest using print_r / error_log to determine what the trouble content is. In plugins/pubIds/doi/DOIPubIdPlugin.inc.php, look near line 408 (cited in the error message) and you’ll find:

Let’s try to capture the case where an array is being passed into PKPString::strtolower instead of the string it expects. Go a few lines up, and above the following line…

$fieldData = [

…insert this:

$fieldLocale = $form->submissionContext->getData('primaryLocale');
$acronymData = $form->submissionContext->getData('acronym', $fieldLocale);
if (is_array($acronymData)) {
  // This is the error condition we're looking for.
  error_log('Field locale: ' . print_r($fieldLocale,true));
  error_log('Acronym data: ' . print_r($acronymData,true));
}

Trigger the error again, then look for the debug output in your log file.

(Caveat: I’ve written but not tested the above code.)

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks for your help.
I added the code.
The fieldLocale just returns blank data:
Field locale: , referer: …
However Acronym returned:
Acronym data: Array\n(\n [en_CC] => JPPS\n [en_US] => JPPS\n)
I then removed acronym setting for the locale en_CC from journal settings but it still returns an array
Acronym data: Array\n(\n [en_US] => JPPS\n);

So I assume the $fieldLocale being blank is the problem? There must be a locale missing in the DB somewhere?

Hi @jhennig,

The empty $fieldLocale is the problem, but it normally comes from the primary_locale column in the journals table, which we’ve already verified is correct. Can you check the following query?

SELECT * FROM journal_settings WHERE setting_name='primaryLocale';

This shouldn’t give any results; if there is something, it might be causing a conflict.

Regards,
Alec Smecher
Public Knowledge Project Team

That was it. There was a primaryLocale setting in the journal_settings table. It had a null value.
I deleted it and now everything works.
Thanks so much.

Jeremy

Hi @asmecher ,
my error log is slightly different.
Could you help me?

PHP Fatal error:  Uncaught InvalidArgumentException: Passed value cannot be an array in /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php:45\nStack trace:\n#0 /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php(73): Stringy\\Stringy->__construct(Array, NULL)\n#1 /var/www/ojs-3.3.0-13/lib/pkp/classes/core/PKPString.inc.php(160): Stringy\\Stringy::create(Array)\n#2 /var/www/ojs-3.3.0-13/cache/t_compile/a95e9f20492587d73a4f35fa465ca6ee809b9709^c2055d14f27582f3361894f4184ce1a4c0497385_0.app.frontendpagessearchAuthor.php(58): PKPString::substr(Array, 0, 1)\n#3 /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_6394f463e982d7_61763347(Object(Smarty_Internal_Template))\n#4 /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template))\n#5 /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render(Object(Smarty_Internal_Template))\n#6 /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(232): Smarty_Internal_Template->render(false, 1)\n#7 /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, 'a95e9f20492587d...', NULL, 1)\n#8 /var/www/ojs-3.3.0-13/lib/pkp/classes/template/PKPTemplateManager.inc.php(1187): Smarty_Internal_TemplateBase->display('frontend/pages/...', NULL, 'a95e9f20492587d...', NULL)\n#9 /var/www/ojs-3.3.0-13/pages/search/SearchHandler.inc.php(297): PKPTemplateManager->display('frontend/pages/...')\n#10 /var/www/ojs-3.3.0-13/lib/pkp/classes/core/PKPRouter.inc.php(395): SearchHandler->authors(Array, Object(Request))\n#11 /var/www/ojs-3.3.0-13/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#12 /var/www/ojs-3.3.0-13/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route(Object(Request))\n#13 /var/www/ojs-3.3.0-13/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request))\n#14 /var/www/ojs-3.3.0-13/index.php(68): PKPApplication->execute()\n#15 {main}\n  thrown in /var/www/ojs-3.3.0-13/lib/pkp/lib/vendor/danielstjules/stringy/src/Stringy.php on line 45

regards,
Adriano Moreno

@Adriano_Jose
What do you get when you run this SQL:
SELECT * FROM journal_settings WHERE setting_name=‘primaryLocale’;

If you get something, even a blank field try deleting it. Note You may want to backup your journal_settings table first.

Jeremy

Hi @jhennig
I did this select and the result came empty.
I also checked this query and found nothing anomalous:

Can you check your journal_settings table for unusual entries with setting_name='acronym', e.g. multiple entries with the same locale for the same journal (journal_id)?

What else could it be?

regards,
Adriano Moreno

Are you trying to do a search when the error occurs?
Just a wild guess but have you tried clearing your cache manually? By that I mean go into your cache folder and delete the files also delete files in the cache/t_compile folder.
I see that the cache file is referenced in your stack trace.