[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