OJS 3.3.0.11 : « Failed Ajax request or invalid JSON returned. » when trying to upload a final version

This is a complement about this post which is closed so I couldn’t answer.
First, thanks to Alec Smecher for the answer. The corrected code works.
Second, there is in the same page the same problem for the latest entry (« Version(s) révisée(s) », “Revised Versions” I guess), which is not corrected by this patch; the log message is then

PHP Fatal error: Declaration of ManageCopyeditFilesForm::execute($stageSubmissionFiles, $fileStage = null) must be compatible with ManageSubmissionFilesForm::execute($stageSubmissionFiles = null, $fileStage = null, …$functionArgs) in /var/www/html/ojs-3.3.0-11/lib/pkp/controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.inc.php on line 33

I prefer to signal it, just in case this one was not already catched for the next update… I guess the problem is similar.
Best regards,

Hi @ecuris,

This is Can't upload Copyedited files when in submission's Copyediting workflow · Issue #8068 · pkp/pkp-lib · GitHub, which has already been fixed in the git repository and will be released in 3.3.0-12.

Thanks,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi @asmecher ,

So this is another follow up. In my case the two-line quick fix also solved only uploading to ‘Draft files’ grid, uploading to ‘Copyedited’ grid is still affected. Moreover, the same issue concerns uploading to ‘Review files’ grid at the ‘Review’ stage of the submission.

Hi @p_urbanczyk,

Can you check your PHP error log and post any relevant messages?

Regards,
Alec Smecher
Public Knowledge Project Team

Would these be of any use?

77.252.63.45 zfn.edu.pl - [02/Sep/2022:19:50:00 +0200] "GET /index.php/zfn/$$$call$$$/grid/files/copyedit/copyedit-files-grid/select-files?submissionId=576&stageId=4&_=1662128245118 HTTP/1.1" 500 - "https://zfn.edu.pl/index.php/zfn/workflow/index/576/4" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"

and

77.252.63.45 zfn.edu.pl - [02/Sep/2022:21:12:03 +0200] "GET /index.php/zfn/$$$call$$$/grid/files/review/editor-review-files-grid/select-files?submissionId=602&stageId=3&reviewRoundId=511&_=1662145853528 HTTP/1.1" 500 - "https://zfn.edu.pl/index.php/zfn/workflow/index/602/3" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"

Hi @p_urbanczyk,

Those are from the PHP access log; they do show a 500 response (Internal Server Error) but don’t include the error message itself. You’ll need to look for the equivalent entries in the PHP error log.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher
Thanks for the reply. Unfortunately the error logs for today show only some irrelevant entries (unsuccessful external exploit attempts). It’s possible that the error reporting settings on the server side are weird. I’ll try to copy the application to the (similar) environment that I have more control over and recreate the bug. Then I’ll post the logs here.

Hi @asmecher
Here are the corresponding PHP error log entries (from my local server):

[Sun Sep 04 22:05:58.797599 2022] [php:error] [pid 21576:tid 1852] [client ::1:56235] PHP Fatal error:  Declaration of ManageCopyeditFilesForm::execute($stageSubmissionFiles, $fileStage = null) must be compatible with ManageSubmissionFilesForm::execute($stageSubmissionFiles = null, $fileStage = null, ...$functionArgs) in C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\controllers\\grid\\files\\copyedit\\form\\ManageCopyeditFilesForm.inc.php on line 33, referer: http://localhost/zfn_ojs3/index.php/zfn/workflow/index/576/5
[Sun Sep 04 22:07:09.008442 2022] [php:error] [pid 21576:tid 1860] [client ::1:56280] PHP Fatal error:  Declaration of ManageReviewFilesForm::execute($stageSubmissionFiles, $fileStage = null) must be compatible with ManageSubmissionFilesForm::execute($stageSubmissionFiles = null, $fileStage = null, ...$functionArgs) in C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\controllers\\grid\\files\\review\\form\\ManageReviewFilesForm.inc.php on line 87, referer: http://localhost/zfn_ojs3/index.php/zfn/workflow/index/602/3

Hello,

I’ve been struggling with similar error and searching this forum upside down and came up with this post, its fresh and new, so i wont open another thread, will wait for a solutions on this one.
Here are some error logs from chrome console.
Screenshot_1
This is happening only at Journal>Sections>Create section or when you try to edit any section there. Please if you know to point me to the right direction i will be happy. Thanks.

Hi @jhrs and @asmecher

I can confirm that I’ve encountered the same problem in my installation. The associated logs are below (adding and editing a journal section, respectively).

[Mon Sep 05 10:53:04.005152 2022] [php:error] [pid 19880:tid 1856] [client ::1:50524] PHP Fatal error:  Uncaught Error: Non-static method PKPApplication::getRequest() cannot be called statically in C:\\xampp\\htdocs\\zfn_ojs3\\plugins\\generic\\openAIRE\\OpenAIREPlugin.inc.php:102\nStack trace:\n#0 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\plugins\\HookRegistry.inc.php(107): OpenAIREPlugin->initDataSectionFormFields('sectionform::in...', Array)\n#1 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\form\\Form.inc.php(237): HookRegistry::call('sectionform::in...', Array)\n#2 C:\\xampp\\htdocs\\zfn_ojs3\\controllers\\grid\\settings\\sections\\form\\SectionForm.inc.php(80): Form->initData()\n#3 C:\\xampp\\htdocs\\zfn_ojs3\\controllers\\grid\\settings\\sections\\SectionGridHandler.inc.php(195): SectionForm->initData()\n#4 C:\\xampp\\htdocs\\zfn_ojs3\\controllers\\grid\\settings\\sections\\SectionGridHandler.inc.php(179): SectionGridHandler->editSection(Array, Object(Request))\n#5 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\PKPRouter.inc.php(395): SectionGridHandler->addSection(Array, Object(Request))\n#6 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)\n#7 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\Dispatcher.inc.php(144): PKPComponentRouter->route(Object(Request))\n#8 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request))\n#9 C:\\xampp\\htdocs\\zfn_ojs3\\index.php(68): PKPApplication->execute()\n#10 {main}\n  thrown in C:\\xampp\\htdocs\\zfn_ojs3\\plugins\\generic\\openAIRE\\OpenAIREPlugin.inc.php on line 102, referer: http://localhost/zfn_ojs3/index.php/zfn/management/settings/context
[Mon Sep 05 10:53:09.308303 2022] [php:error] [pid 19880:tid 1856] [client ::1:50528] PHP Fatal error:  Uncaught Error: Non-static method PKPApplication::getRequest() cannot be called statically in C:\\xampp\\htdocs\\zfn_ojs3\\plugins\\generic\\openAIRE\\OpenAIREPlugin.inc.php:102\nStack trace:\n#0 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\plugins\\HookRegistry.inc.php(107): OpenAIREPlugin->initDataSectionFormFields('sectionform::in...', Array)\n#1 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\form\\Form.inc.php(237): HookRegistry::call('sectionform::in...', Array)\n#2 C:\\xampp\\htdocs\\zfn_ojs3\\controllers\\grid\\settings\\sections\\form\\SectionForm.inc.php(80): Form->initData()\n#3 C:\\xampp\\htdocs\\zfn_ojs3\\controllers\\grid\\settings\\sections\\SectionGridHandler.inc.php(195): SectionForm->initData()\n#4 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\PKPRouter.inc.php(395): SectionGridHandler->editSection(Array, Object(Request))\n#5 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)\n#6 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\Dispatcher.inc.php(144): PKPComponentRouter->route(Object(Request))\n#7 C:\\xampp\\htdocs\\zfn_ojs3\\lib\\pkp\\classes\\core\\PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request))\n#8 C:\\xampp\\htdocs\\zfn_ojs3\\index.php(68): PKPApplication->execute()\n#9 {main}\n  thrown in C:\\xampp\\htdocs\\zfn_ojs3\\plugins\\generic\\openAIRE\\OpenAIREPlugin.inc.php on line 102, referer: http://localhost/zfn_ojs3/index.php/zfn/management/settings/context

Update:
I’m testing the whole process of publishing a document and i’m facing this error again on another page, here is a screen shot. This is copyediting process before publishing the document. Draft Files > Upload/Select files, when i click the upload button it shows the following error.
Screenshot_1

EDIT1:
Tested the copyedited button to upload files, getting the same error.
Screenshot_2

EDIT2:
Changing the PHP version from 8.1 to 7.4 fixed the problem at draft files upload and copyedited files upload, the create new section or edit section problem still exists.

@jhrs Good catch. In my case downgrading PHP version to 7.4. fixed both issues.
@asmecher It seems that the problem is PHP 8.x related. Note that PHP 8.0.x is one of recommended configurations in readme.md.

@p_urbanczyk, from the error message, it looks like the problem is in the OpenAIRE plugin. That’s either maintained by Antti-Jussi or someone at the OJS-DE project; tagging @ajnyga, who would know.

Thanks,
Alec Smecher
Public Knowledge Project Team

@p_urbanczyk I’m glad that you fixed your problem. Mine still exists, on the section menu only… tried few versions for php including 8.0 and the sections menu still gives an error. Only 7.4 version of PHP works on file upload at copyediting part, the rest versions give me error.

Best regards,
JHRS

@asmecher , thanks for the input. Disabling OpenAIRE plugin in PHP 8.0.x environment indeed fix the @jhrs 's issue with creating/editing new journal section.

To resolve the issue with uploading files to the ‘Copyedited’ grid at the ‘Copyediting’ stage and to ‘Review files’ grid at the ‘Review’ stage in PHP 8.0.x one need to edit out the the function execute parameters in similar manner as it is done here in two other places, namely in controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.inc.php on line 33 and controllers/grid/files/review/form/ManageReviewFilesForm.inc.php on line 88.

1 Like

Hi @p_urbanczyk,

Those are already resolved in these two issues:

Unfortunately it looks like a backwards-incompatible change was introduced late in the PHP 8.0.x dev cycle; this didn’t affect previous releases of PHP 8.0. But I’ll release OJS/OMP/OPS 3.3.0-12 soon to resolve them.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Thanks, I do not think the OpenAire plugin has been tested with PHP8 yet. I will do a new release later this week.

Just to make sure, you are at OJS 3.3.0 ?

Yes. The problem with OpenAIRE plugin causing the “Failed Ajax request” that gives the PHP error message while adding/editing journal section occurs with the latest OJS version (3.3.0.11) running on PHP 8.0+ server.

@asmecher So there is no fix yet for Journal>Sections and create new section or edit an existing section? Here is a picture with information.
Screenshot_4

@p_urbanczyk When sections part is fixed, i will try and upgrade the php version and check if i can fix the error on copyediting stage on submission and upload files.

@jhrs, I’d need to see your PHP error log for details. There should be an error message recorded at the time you hit the broken page.

Regards,
Alec Smecher
Public Knowledge Project Team