Failed Ajax request or invalid JSON returned trying to upload file to 3.3.0.13

Recently upgraded to 3.3.0.13 from 3.2.0.8 because our hosting partner forced us on to php 8.0. Recovering from that took a couple of weeks due to database issues.

Everything seems to be working, except we cannot upload pdfs, neither in quicksubmit nor through submissions. Uploading the journal cover when creating the new issue worked fine.

Is this related to php 8.0.X? Can’t see the error logs and have asked our host to contact me so we can get to them. Is there anything we should look for or any new parameters needed in config or in php.ini?

Best regards
Geir Rosset
Oslo
Norway

Update 1: Creating a new issue worked. Uploading a cover image worked. But OJS hangs when saving after editing the issue and entering a description for the new issue. The text I was trying to enter was pasted from Word and again from Sublime text. In both cases it hangs when saving, but if I type the exact same sentence it saves fine.

So there are at least two problems here. Uploading files and pasting text.

Update 2: Adding the Issue galley as a pdf works. I can’t drag and drop the pdf file, but clicking “Upload file” lets me select and upload it without errors.

Same issue as here: Pasting text OJS 3.2.1.1 but no solution. This has worked without issues since OJS 2. How on earth is the browser distinguishing between text that is typed manually and text that is pasted? No special charcters when viewing the source either.

Update 3: Tried copying and pasting some other text from the same document as in “Update 1”. This worked. Can’t see any difference between the two paragraphs. What could make one piece of text be accepted and the other cause a “crash”?

So the inital AJAx issue is persistent. Fails every time. The second copy/paste issue is intermittent.

Hi @geirrosset

If you’re getting a "failed Ajax request … " error, there is almost certainly a PHP Fatal Error in your server log with some information here.

Best
Jason

This is the first fatal error in the log. This is when trying to add a pdf through quicksubmit. Don’t know what that ojs2 404 not found at the end is either.

[12-Jan-2023 08:46:43 UTC] PHP Fatal error: Uncaught Error: Call to undefined method SubmissionFileDAO::getAllFileStages() in /customers/9/2/7/c3lqi88hb/webroots/xxxxx/lib/pkp/controllers/wizard/fileUpload/PKPFileUploadWizardHandler.inc.php:75
Stack trace:
#0 /customers/9/2/7/c3lqi88hb/webroots/xxxxx/lib/pkp/classes/core/PKPRouter.inc.php(387): PKPFileUploadWizardHandler->authorize(Object(Request), Array, Array)
#1 /customers/9/2/7/c3lqi88hb/webroots/xxxxx/lib/pkp/classes/core/PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)
#2 /customers/9/2/7/c3lqi88hb/webroots/xxxxx/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPComponentRouter->route(Object(Request))
#3 /customers/9/2/7/c3lqi88hb/webroots/xxxxx/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch(Object(Request))
#4 /customers/9/2/7/c3lqi88hb/webroots/xxxxx/index.php(68): PKPApplication->execute()
#5 {main}
thrown in /customers/9/2/7/c3lqi88hb/webroots/xxxxx/lib/pkp/controllers/wizard/fileUpload/PKPFileUploadWizardHandler.inc.php on line 75

[12-Jan-2023 08:46:49 UTC] ojs2: 404 Not Found

Hi @geirrosset

I think that you may be running old code here. This file:

lib/pkp/controllers/wizard/fileUpload/PKPFileUploadWizardHandler.inc.php

As mentioned in your error message, no longer exists in OJS 3.3. It was renamed to just FileUploadWizardHandler.inc.php when the submission file code was refactored back in 2020. See e.g.

That would definitely explain why you’re having problems uploading files. I’m not sure if you are running OJS 3.3 off of a downloaded package from pkp.sfu.ca or if you’re building from source via github, but if you’re doing the former please make sure that you’ve updated any plugins via the gallery, and if you’re doing the latter please make sure you’ve also updated any submodules since upgrading to 3.3.

Best
Jason

I downloaded the full 3.3.0.13 package from pkp and tried to follow the upgrade readme.

Do I need to delete the whole root directory, keeping just config.inc.php, files and public, move 3.3.0.13 into the empty folder and copy back the before mentioned files to be sure? Db has already been upgraded so that should still just work?

Or is there an easier way to get rid of just the old files? Can’t understand how a file that is no longer in use can be called in the first place…

Okay, so did you untar the downloaded package over top of the old one, or did you remove the old one completely first?

It’s weird now because your live site has plugins installed in it that would not be in the downloaded archive from PKP. Normally you’d start with a completely fresh source folder, copy in your public/ files (your files/ directory shouldn’t be in your webroot at all… right? That’s a security hole if it is.), your configuration files, and your plugins.

This is entirely a guess but I suspect that the OJS 3.2 version of FileUploadWizardHandler.inc.php still lives on your file system. And it’s being invoked in the class hierarchy, and I bet that if you didn’t delete all of the old OJS 3.2 files, the PKPFileUploadWizardHandler.inc.php class, which is the parent of the other one, is still in your installation, and it’s trying to use a method in a file that did get updated that no longer exists.

In any case, I’d start with completely fresh 3.3.0.13 code and move over your config file, public/ directory, and the plugins that you would have installed via the plugin gallery.

Best
Jason

1 Like

I’ll delete everything and start fresh. But while on that subject. Doing a backup I’m seeing thousands of .log files. Do I need backups of those? What are they and why so many. Backing them up over ftp takes for ever.

So I deleted everything, uploaded 3.3.0.13. Moved files, public and config back into the root directory. Downloaded the latest versions of the Medical theme and quicksubmit plugin. Seemed to work, I was allowed to choose and upload the pdf, but now it fails with a http error 500 when clicking the save button in quicksubmit. Strange thing is that the article is published. So is there a redirect after saving that fails?

The log files are the output from the various scheduled tasks that run every day. You don’t need to keep them if you don’t want to.

If you’re still seeing a 500 error, there’s still a PHP fatal error being logged in your error log.

Best
Jason