Various javascript errors in OJS 3.1.1-2

So, not sure if it helps, but found out now that the first error only occurs in the “Metadata” modal for articles in production, not for “Show metadata” for submissions that have not gone to production yet.

Are there any related PHP errors?

There are no errors, but the following warning is printed 4 times after I click save:

PHP Warning:  Cannot use a scalar value as an array in ..../lib/pkp/classes/core/ on line 133

Not sure if it’s related.

Actually, are there any problems with tables in the database in fields related to localized submission metadata? For example, wrong encoding, unusual values? And what about PHP version and extensions? But in this case, the problem would not be browser related…

I added the following debug code to line 133

error_log('DEBUG: key = ' . $key . ', locale = ' . $locale . ', value = ' . $value . '\n');

And it seems every time the above warning is printed, I get following right before:

DEBUG: key = metaCitations, locale = nb_NO, value = 1\\n referer: https://..../index.php/test/management/settings/access

For this particular journal, nb_NO, is only activated for UI, english is the primary locale.

That comes from journal_settings table, there you can find pairs settings_namesettings_value. There can be found setting metaCitations for each journal. I personally don’t know where it is used in OJS3. But I’ve found a similar thread with exact PHP warning. In particular, the solution from Alec: Cannot use a scalar as an array - #21 by asmecher

Thanks! That got rid of the warning in the log, and the frontend error changed character. Now I don’t get the eternal spinner, instead I get the following two errors in the form (at the top of the modal):

Errors occurred processing this form
[Please enter the title of your article. (Norsk Bokmål)]
[Please enter your article’s abstract. (Norsk Bokmål)]

Even though the fields are filled out in the form. Now nothing is printed to the server log. Norsk Bokmål (nb_NO) is only activated for the UI for this journal, and I’m editing using en_US, which is the primarty locale.

are the forms enabled for Norvegian from Settings > Website > Languages? edit: I see they are not. I have encountered similar situations when using only Finnish locale.

Even if I deactivate no_NB completely for that journal, I still get the same error.

In the journal_settings table I would check also: supportedSubmissionLocales, supportedLocales and supportedFormLocales. The values there have a form of arrays. nb_NO locale should appear only in a second setting. Also can be helpful looking at the submission_setting table, particularly at the submission(s) you encountered the problem with. They can be found by submission_id. Particularly, settings: title and abstract; they are localized.

This OJS instance is the one upgraded from OJS 2+, right? I’m not an expert in this field. Never have seen such error before. Were there any problems with an upgrade process before?

This is what I get:

ojs => select * from journal_settings where journal_id = 30 and setting_name like '%supported%';

 journal_id | locale |        setting_name        |                                     setting_value                                      | setting_type
         30 |        | supportedSubmissionLocales | a:1:{i:0;s:5:"en_US";}                                                                 | object
         30 |        | supportedFormLocales       | a:1:{i:0;s:5:"en_US";}                                                                 | object
         30 |        | supportedLocales           | a:5:{i:0;s:5:"en_US";i:1;s:5:"nb_NO";i:2;s:5:"es_ES";i:3;s:5:"fr_CA";i:4;s:5:"it_IT";} | object

Looks correct, right?

I think the problem I have experienced occurs when you have a submission made with for example fi_FI locale (the submission locale is fi_FI) but forms for that locale are not enabled.

Interesting, that solved the form problem (edit: by activating nb_NO for forms), but now we’re back to the eternal spinner and the JSON.parse() error described originally. Still no errors in the log.

Tagging here @asmecher and @NateWr

This is usually far fetched, but check that the browsers you are testing this with do not have any advertisement filtering plugins enabled. Like uBlock.

No adblockers, as far as I can tell. And most of the JS seems to work most of the time, it’s just a few widgets that are affected.

Ok, just sounded a bit like this: OJS3: Reviewer files > More Information > History does not load

I turned off all browser extensions, just to try, and there was no effect.

I checked with my colleague who uses Chrome on Windows, and that problem (second one in the original list), went away when the adblocker was turned off.

Ah ok, I see I mixed your two errors above. Good to hear that at least one is solved.

Interesting that both uBlock Origin and Adblocker prevent that modal window from loading though… Details here: [OJS] uBlock Origin browser plugin causing problems in OJS 3.0.2 · Issue #2316 · pkp/pkp-lib · GitHub