recently we updated a server from php 5.3 to php 7, actually I don't know if the update causes this issue, but when I go to insert a file on TinyMCE javascirpt I receive this error message:
The server response wasn't JSON format
I haven't found anything on internet about it.
here is Json_data:
{"method":"fm.insertFiles","params":[{"path0":"{0}/Sage.JPG"}],"id":"c0"}
here is TinyMCE configuration:
tinyMCE.init({
// General options
mode : "exact",
elements : "msg_body",
theme : "advanced",
theme_advanced_resizing_max_width : 530,
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,spellchecker,filemanager",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,|,styleselect,formatselect,|,forecolor,backcolor,<?if ($staff[perm][msg_replies]==1) {?>|,insertfile,link,<?}?>|,spellchecker",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
//External
extended_valid_elements : "iframe[src|width|height|name|align]",
// Example content CSS (should be your site CSS)
content_css : "../style-bijou.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "cms-image_list.php",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bijou Weddings styles'},
{title : 'Bijou copy', block : 'p', classes : 'copy'},
{title : 'Bijou copy bold', inline : 'span', classes : 'title'},
{title : 'Corporate Event styles'},
{title : 'Event bullets small', block : 'p', classes : 'corpbodybull'},
{title : 'Event bullets big', block : 'p', classes : 'corpbull'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
Do you have any idea please? thanks
I finally found the problem,
The plugin "filemanager" generate a php error, the file History.php
located in folder /plugins/filemanager/plugins/History
is using a php function called split
which is obsoleted for php7.
So I swap the function split
with function explode
. Now the file inserting is working properly.
Hope this will be useful.
here is the explanation in php.net: http://php.net/manual/en/function.split.php and http://php.net/manual/en/function.explode.php
Try to send the response with$data = {"method":"fm.insertFiles","params":[{"path0":"{0}/Sage.JPG"}],"id":"c0"}; json_encode($data);
intead of json_data