OJS 3.4.0-5: "Failed Ajax Request" and "Unexpected Error" with Plugin Issues

Hi everyone,

I’m encountering three errors in my OJS installation:

1. Failed Ajax Request or Invalid JSON Returned

This error affects all installed plugins.

Error Log:

[04-Jun-2024 10:49:44 UTC] PHP Deprecated: stripslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /home/webroot/public_html/lib/pkp/classes/citation/Citation.php on line 118

2. An Unexpected Error Has Occurred

This error appears when I attempt to reload the page.

Error Log:

[04-Jun-2024 10:49:44 UTC] PHP Deprecated: stripslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /home/webroot/public_html/lib/pkp/classes/citation/Citation.php on line 118

3. Class “Locale” Not Found

This error occurs only on my localhost after attempting a fix.

Error Log:

PHP Fatal error: Uncaught Error: Class "Locale" not found in C:\xampp\htdocs\www\webroot\lib\pkp\classes\i18n\Locale.php:148

Steps Taken:

Additional Information:

  • Application: OJS 3.4.0-5
  • These errors started appearing after upgrading from Linux 7 to Alma Linux 9 in WHM and enabling website security.
  • A previous forum post by @jnugent offered a solution for a similar “Failed Ajax Request” error: https://forum.pkp.sfu.ca/tag/security

Request for Help:

I’d appreciate any assistance in resolving these errors and restoring functionality to my OJS installation.

Best Regards
Darryl M. Nuyda

Hi,
php-intl is installed and active?

Hello @loadbrain ;

Thanks for response on this post;

and the error still exist and add.

[05-Jun-2024 01:22:02 UTC] PHP Deprecated:  Creation of dynamic property SliderHomeSettingsForm::$successMessage is deprecated in /home/webroot/public_html/plugins/generic/sliderHome/classes/components/form/context/SliderHomeSettingsForm.inc.php on line 45

[05-Jun-2024 01:22:13 UTC] PHP Deprecated:  stripslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /home/webroot/public_html/lib/pkp/classes/citation/Citation.php on line 118
[05-Jun-2024 01:24:12 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getDatetimePosted() on null in /home/webroot/public_html/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php:148
Stack trace:
#0 /home/webroot/public_html/pages/gateway/GatewayHandler.php(215): APP\plugins\generic\announcementFeed\AnnouncementFeedGatewayPlugin->fetch(Array, Object(APP\core\Request))
#1 [internal function]: APP\pages\gateway\GatewayHandler->plugin(Array, Object(APP\core\Request))
#2 /home/webroot/public_html/lib/pkp/classes/core/PKPRouter.php(334): call_user_func(Array, Array, Object(APP\core\Request))
#3 /home/webroot/public_html/lib/pkp/classes/core/PKPPageRouter.php(277): PKP\core\PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(APP\core\Request), Array, false)
#4 /home/webroot/public_html/lib/pkp/classes/core/Dispatcher.php(165): PKP\core\PKPPageRouter->route(Object(APP\core\Request))
#5 /home/webroot/public_html/lib/pkp/classes/core/PKPApplication.php(388): PKP\core\Dispatcher->dispatch(Object(APP\core\Request))
#6 /home/webroot/public_html/index.php(21): PKP\core\PKPApplication->execute()
#7 {main}
  thrown in /home/webroot/public_html/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php on line 148
[05-Jun-2024 01:24:10 UTC] ojs2: 404 Not Found
[05-Jun-2024 01:24:10 UTC] ojs2: 404 Not Found
[05-Jun-2024 01:24:12 UTC] ojs2: 404 Not Found

When I enabled the ‘extension=intl’ to my localhost and try to check version in cmd/terminal.

The errors pop up.

# php tools\upgrade.php check
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["announcementfeedplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["driverplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["dublincoremetaplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["googlescholarplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["htmlarticlegalleyplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["lensgalleyplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["pdfjsviewerplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["staticpagesplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["tinymceplugin",0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
["webfeedplugin",0]
Database query
SELECT * FROM versions WHERE current = 1 AND product_type = ? AND product = ?
["core","ojs2"]
Code version:      3.4.0.5
Database version:  3.4.0.5
Latest version:    3.4.0.5
Your system is up-to-date

When the php-intl enabled and try to login and view the article the error shown:

[Wed Jun 05 12:09:57.680841 2024] [php:notice] [pid 7416:tid 1868] [client ::1:61545] Database query\nSELECT * FROM versions WHERE current = 1 AND product_type = ? AND product = ?\n["core","ojs2"], referer: http://localhost/www/domain/index.php/jpair

[Wed Jun 05 12:10:27.839646 2024] [php:notice] [pid 7416:tid 1872] [client ::1:61579] Database query\nUPDATE sessions\n\t\t\t\tSET\n\t\t\t\t\tuser_id = ?,\n\t\t\t\t\tip_address = ?,\n\t\t\t\t\tuser_agent = ?,\n\t\t\t\t\tcreated = ?,\n\t\t\t\t\tlast_used = ?,\n\t\t\t\t\tremember = ?,\n\t\t\t\t\tdata = ?,\n\t\t\t\t\tdomain = ?\n\t\t\t\tWHERE session_id = ?\n[null,"::1","Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/125.0.0.0 Safari\\/537.36",1717560372,1717560627,0,"csrf|a:2:{s:9:\\"timestamp\\";i:1717560627;s:5:\\"token\\";s:32:\\"17b86694a07a59ebd3a0e376e2c351c7\\";}","localhost","d6iu97oqocmfah0akdj005eenb"], referer: http://localhost/www/domain/index.php/index/login

Best Regards

Darryl

I’m confused by the errors I’m encountering. When I download my OJS database and run it on localhost, I don’t see the “Failed Ajax Request” or “Unexpected Error” messages. Everything seems to work correctly except for viewing articles, which results in an HTTP Error. However, on the live website, I can view the articles but the dashboard displays errors like “Failed Ajax Request” and “Unexpected Error.”

I’m seeing this specific error message in my PHP error log:

php tools\upgrade.php check

Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“announcementfeedplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“driverplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“dublincoremetaplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“googlescholarplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“htmlarticlegalleyplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“lensgalleyplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“pdfjsviewerplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“staticpagesplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“tinymceplugin”,0]
Database query
SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ? AND context_id = ?
[“webfeedplugin”,0]
Database query
SELECT * FROM versions WHERE current = 1 AND product_type = ? AND product = ?
[“core”,“ojs2”]
Code version: 3.4.0.5
Database version: 3.4.0.5
Latest version: 3.4.0.5
Your system is up-to-date

Best Regards,

Darryl

Hi @OJS_Darryl,

You appear to be encountering this bug:

It’ll be fixed in the next release of OJS 3.4.0, but in the meantime, you can apply either of the patches linked from that issue – they’re equivalent. It’s a one-line fix. Another alternative would be to disable the announcement feed plugin.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher;

Thanks for the response. I was unable to disable the Announcement Plugin from the dashboard, so I tried modifying it through the database.

After, Applying above mention.

I process this another error log.

Error Log:

[04-Jun-2024 10:49:44 UTC] PHP Deprecated: stripslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /home/webroot/public_html/lib/pkp/classes/citation/Citation.php on line 118

and apply this Not find DOI Plugin? - #25 by mgax

image

This error appears in the error log.

[05-Jun-2024 14:47:50 UTC] ojs2: 404 Not Found
[05-Jun-2024 14:48:43 UTC] ojs2: 404 Not Found

But the Failed Ajax Request” and “Unexpected Error” is still the same no changes at all

image

[05-Jun-2024 15:11:33 UTC] PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /home/webroot/public_html/plugins/importexport/portico/PorticoExportPlugin.php on line 230

Please Help me,

Best Regards,

Darryl

I’m requesting assistance from the website security team regarding this error. The error pops up whenever a security setup is performed. Here’s the reply I received from them:

We have identified the following out-of-date software on your server during our cleanup process:

Warning: Found outdated Laravel inside: ./lib/pkp/lib/vendor/laravel/framework/src - Version: 9.52.5 (from ./lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Foundation/Application.php)- Please update asap.

Outdated software is the leading cause of site infections, and reinfections. It is highly encouraged that you upgrade all software immediately.

Best Regards,

Darryl

I believe the issue was resolved due to a miscommunication between the website security system and the Open Journal Systems (OJS) software. My solution involved allowing access from the IP address assigned to my website, and after 30 minutes, all OJS functionalities were working normally.

image

Best Regards
Darryl Nuyda