Symptoms
-
 Unable to install/remove the plugin/theme in Plesk > example.com > WordPress, the process fails with the error below:
An error has occurred when decoding JSON by Zend_Json: Illegal Token
Failed to reset cache for the instance #74, reason: An error has occurred when decoding
JSON: Illegal Token - The same error can be sent to the administrator of the WordPress instance.
-
There is a Byte-Order Mark (BOM) character in one of the WordPress files with
.php
extension.
Cause
Product issue:
-
#EXTWPTOOLK-4736 “Update of certain plugins & themes will not mark WordPress sites as broken if there were JSON decoding errors.”
Fixed in:- WP Toolkit 4.8.4 29 June 2020
Resolution
Workaround
If an update is not possible for some reason, apply the workaround below:
Temporary solution
-
Log into the serer via SSH.
- Execute the command below to find
.php
files with the BOM character:# grep -rlI $’xEFxBBxBF’ /var/www/vhosts/example.com/httpdocs | grep -i .php$
/var/www/vhosts/example.com/httpdocs/wp-content/plugins/vc-google-maps/vc_extend.php
-
Create a backup of the found file from the step â„–2:
# cp -a /var/www/vhosts/example.com/httpdocs/wp-content/plugins/vc-google-maps/vc_extend.php{,.bkp}
-
Run the command below to remove BOM character from the affected WordPress file:
# sed -i ‘1 s/^xefxbbxbf//’ var/www/vhosts/example.com/httpdocs/wp-content/plugins/vc-google-maps/vc_extend.php