Failed Ajax request or invalid JSON returned occurred into fatal error when editing Custom Header Plugin

Hello, everyone

I need some help to fix some of my issues I encountered this day.
Description of issue or problem I’m having:
Failed Ajax request or invalid JSON returned occurred when I trying to use the custom header plugin,
PHP log says: PHP Fatal error: Declaration of CustomHeaderSettingsForm::execute($request, …$functionArgs) must be compatible with Form::execute(…$functionArgs)

Steps I took leading up to the issue:
Previously it works fine, but after I use the Select PHP version from my host cPanel and upgrade it into PHP 8.0.0(Previously PHP 7.4.0) the error occurred.

What I tried to resolve the issue:
I already tried to reinstall the Custom Header Plugin, but it doesn’t do anything. I also tried to revert back into PHP 7.4.0. but instead, the entire site goes HTTP error 500 with:
PHP Fatal error: Uncaught Error: Call to a member function getPrimaryLocale() on null in /home/journals/public_html/lib/pkp/classes/i18n/
Stack trace:
#0 /home/journals/public_html/lib/pkp/classes/i18n/ PKPLocale::getLocale()
#1 /home/journals/public_html/lib/pkp/classes/core/ PKPLocale::initialize(Object(Request))
#2 /home/journals/public_html/lib/pkp/classes/core/ Dispatcher->dispatch(Object(Request))
#3 /home/journals/public_html/index.php(68): PKPApplication->execute()

Therefore I revert it back to PHP 8.0.0, and it goes normal again. But, still the Custom Header Plugin says Failed Ajax request or invalid JSON returned.

Application Version OJS

Image that show the error

Thank you for your help.

Hi @Muzakki_Afandi,

Can you confirm what version of the plugin you are currently using? There was a maintenance release in March of this year to fix incompatibility issues with PHP8. Is this the version you are currently using?

Thank you,


Hi @kshuttle

Below is the description of the version I use

@Muzakki_Afandi, I’ve filed this for attention at:

Can you try applying the patch (#21 Fix incompatible function declaration · pkp/customHeader@bb9df40 · GitHub) in your installation and report back whether it resolves the problem with PHP8?

Alec Smecher
Public Knowledge Project Team

1 Like

Tested with PHP8.0.20 and is working nicelly.
Thanks a lot Alec.

1 Like