[OJS 3.1.2] PKP PN Plugin error - Failed Ajax request or invalid JSON returned [close]

Hi @asmecher,

It is that this json has 84000 characters and the editor allows only 32000.

Equally as soon as I activate the PLN plugin, and I try to open the plugins link, it keeps loading and never ends and the following error appears:

200.24.17.147 - - [04/Aug/2020:15:53:59 -0500] “GET /index.php/pruebas_diego/$$$call$$$/grid/settings/plugins/settings-plugin-grid/manage?verb=settings&plugin=plnplugin&category=generic&_=1596574377542 HTTP/1.1” 500 444 “https://revistas.udea.edu.co/index.php/pruebas_diego/management/settings/website” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36”

And when I am clicking on PLN plugin settings, I get the following error:

image

Hi @diegomejia07,

Before I debug further – have you installed the Archive_Tar PEAR module? The PKP|PN plugin requires this.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello all,

I have the same problem, after installing the PKP PN plugin I get the AJAX error,

The error log file gives me the following error

[05-Aug-2020 15:41:15 UTC] PHP Fatal error: require_once(): Failed opening required '/home/jastt2/public_html/lib/pkp/classes/helpers/PKPCurlHelper.inc.php' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home/jastt2/public_html/lib/pkp/includes/functions.inc.php on line 25

also, I’ve updated the PLNPlugin.inc.php file and changed the following code

from
if(!@include_once('Archive/Tar.php')) {
to
if(include_once('Archive/Tar.php')) {

So, any update about this issue?

BTW, the Pear module and Zip extension are both installed on the server.

The OJS version I’m using is: 3.2.1.1 and PKP PN V 2.0.3.1 2020.07.21

Thanks in advance and kind regards,
Jacksi

Hi @KarwanJacksi,

Are you sure you’re using OJS 3.2.1-1? It should definitely include a lib/pkp/classes/helpers/PKPCurlHelper.inc.php.

Regards,
Alec Smecher
Public Knowledge Project Team

Sorry for the incorrect mention of PKP PN version. It is pln-v2.0.1-0.

Yes, I do, it is the latest version released. Current Production Release (June 26, 2020)

So, any idea about that? I still get the AJAX error with the above PHP fatal error. When I disable the PN Plugin, there is no fatal error in the PHP log file.

Kind regards,
Jacksi

Hi @KarwanJacksi,

I think the file lib/pkp/classes/helpers/PKPCurlHelper.inc.php is missing from your installation. You can get it from the .tar.gz download corresponding to the version of OJS that you’re running.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher,

I don’t have this file that you mention in my OJS 3.1.2 installation, and I download the version of this official version and the helpers folder doesn’t exist either

This is my installation

image

This is the downloaded installation folder

image

Hi @asmecher,

The Archive_Tar PEAR module, if it is installed on my server.

image

Hi @diegomejia07,

The problem you’re encountering is different than the one @KarwanJacksi is encountering (with the missing class file). In OJS 3.1.2 that file shouldn’t exist (and the plugin doesn’t try to use it).

Thanks for confirming that the Archive_Tar module is enabled and working.

Next, I’d suggest trying to capture and check the server’s JSON that it sends to your browser, which seems not to be parseable. See these instructions: OJS 3.2.1-1 error: Failed Ajax request or invalid JSON returned - #19 by asmecher

Regards,
Alec Smecher
Public Knowledge Project Team

OMG!, yes that was the problem!

Thanks a lot!
Jacksi

Hi @asmecher,

I have not asked to find the error, I do not know what happens when I activate the plugin, and I really want it to work.

My version of OJS is 3.1.2.0. This plugin should work in this version?

Hi @asmecher,

I found this error, but I don’t know if it has something to do with this

PHP Fatal error:  Uncaught InvalidArgumentException: Key may not be empty in /var/www/html/site.revistas.udea.edu.co/lib/pkp/lib/vendor/firebase/php-jwt/src/JWT.php:74\nStack trace:\n#0 /var/www/html/site.revistas.udea.edu.co/pages/article/ArticleHandler.inc.php(43): Firebase\\JWT\\JWT::decode(NULL, '', Array)\n#1 /var/www/html/site.revistas.udea.edu.co/lib/pkp/classes/core/PKPRouter.inc.php(382): ArticleHandler->authorize(Object(Request), Array, Array)\n#2 /var/www/html/site.revistas.udea.edu.co/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#3 /var/www/html/site.revistas.udea.edu.co/lib/pkp/classes/core/Dispatcher.inc.php(134): PKPPageRouter->route(Object(Request))\n#4 /var/www/html/site.revistas.udea.edu.co/lib/pkp/classes/core/PKPApplication.inc.php(252): Dispatcher->dispatch(Object(Request))\n#5 /var/www/html/site.revistas.udea.edu.co/index.php(68): PKPApplication->execute()\n#6 {main}\n  thrown in /var/www/html/site.revistas.udea.edu.co/lib/pkp/lib/vendor/firebase/php-jwt/src/JWT.php on line 74

Hi @diegomejia07,

Were you able to try my debugging suggestion above?

Regards,
Alec Smecher
Public Knowledge Project Team

hello @asmecher and all … I’m facing this very problem in our OJS 3.1.2.1 installation with the PKP PN plugin v 2.0.1.1 installed

I have checked that php zip and the PEAR Archive_Tar extensions are installed and modified the plugins/generic/PLNPlugin.inc.php file to remove the ‘!@’ before include_once()

I get the same “Failed Ajax request or invalid JSON returned” error when PN plugin settings are called.

There is no error logged in the apache logs at the moment of the error.

I tried to inspect the response through the browser’s console but all I can see is the error code and the headers … there is nothing under the Network’s “Response” tab to check…
I might not doing a good job here, as I have little experience with these tools.

Any tip or pointer to solve this will be greatly appreciated.

Best regards

Hi @hilongo,

Did you remove all the error message suppression? There are cases in a few files:

diff --git a/PLNGatewayPlugin.inc.php b/PLNGatewayPlugin.inc.php
index 3501eb9..c37e93e 100644
--- a/PLNGatewayPlugin.inc.php
+++ b/PLNGatewayPlugin.inc.php
@@ -19,7 +19,7 @@ import('lib.pkp.classes.core.ArrayItemIterator');
 define('PLN_PLUGIN_PING_ARTICLE_COUNT', 12);
 
 // Archive/Tar.php may not be installed, so supress possible error.
-@include_once('Archive/Tar.php');
+include_once('Archive/Tar.php');
 
 class PLNGatewayPlugin extends GatewayPlugin {
 	/** @var $parentPluginName string Name of parent plugin */
diff --git a/PLNPlugin.inc.php b/PLNPlugin.inc.php
index 5292a51..1af15c4 100644
--- a/PLNPlugin.inc.php
+++ b/PLNPlugin.inc.php
@@ -373,7 +373,7 @@ class PLNPlugin extends GenericPlugin {
 
 				return new JSONMessage(true, $form->fetch($request));
 			case 'enable':
-				if(!@include_once('Archive/Tar.php')) {
+				if(@include_once('Archive/Tar.php')) {
 					$message = NOTIFICATION_TYPE_ERROR;
 					$messageParams = array('contents' => __('plugins.generic.pln.notifications.archive_tar_missing'));
 					break;
@@ -561,7 +561,7 @@ class PLNPlugin extends GenericPlugin {
 	 * @return boolean
 	 */
 	public function tarInstalled() {
-		@include_once('Archive/Tar.php');
+		include_once('Archive/Tar.php');
 		return class_exists('Archive_Tar');
 	}
 
diff --git a/classes/DepositPackage.inc.php b/classes/DepositPackage.inc.php
index f74e4f7..64282b3 100644
--- a/classes/DepositPackage.inc.php
+++ b/classes/DepositPackage.inc.php
@@ -242,7 +242,7 @@ class DepositPackage {
 	 * @return string The full path of the created zip archive
 	 */
 	public function generatePackage() {
-		if (!@include_once(dirname(__FILE__).'/../vendor/scholarslab/bagit/lib/bagit.php')) {
+		if (!include_once(dirname(__FILE__).'/../vendor/scholarslab/bagit/lib/bagit.php')) {
 			$this->_logMessage(__('plugins.generic.pln.error.include.bagit'));
 			return;
 		}
diff --git a/classes/form/PLNSettingsForm.inc.php b/classes/form/PLNSettingsForm.inc.php
index 200d189..5e95cd1 100644
--- a/classes/form/PLNSettingsForm.inc.php
+++ b/classes/form/PLNSettingsForm.inc.php
@@ -68,7 +68,7 @@ class PLNSettingsForm extends Form {
 	public function _checkPrerequisites() {
 		$messages = array();
 
-		if (!@include_once('Archive/Tar.php')) {
+		if (!include_once('Archive/Tar.php')) {
 			$messages[] = __('plugins.generic.pln.notifications.archive_tar_missing');
 		}
 		if (!$this->_plugin->curlInstalled()) {

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks for thepromp response @asmecher

I have now removed all the error suppression in the files listed in your post … but with the same result … nothing gets logged at the moment of the error.

Hi @hilongo,

In your message above, you mentioned that you removed @! before include_once – you should only be removing the @ part.

Regards,
Alec Smecher
Public Knowledge Project Team

Yep … Sorry about that … I have reverted the changes and correctly removed only the ‘@’ from the lines. Sadly the situation haven’t changed.

@asmecher … I have the same installation in a test server upgraded to version 3.2.0.3 with the plugin updated and working (at least the plugin’s settings page loads without error) … so maybe is a version incompatibility problem…

I’m about to start upgrading our system all the way to 3.2.1.1 … so maybe this problem will be “solved” in a few more days… and I’ll be posting some new threads :slight_smile:

Thanks again ! :+1: