Syntax error: JSON.parse: unexpected character at line 1 column 1 of the JSON data?

Hi guys - first of all: WOW! with the website design and navigation. How beautiful and so neat! :slight_smile:
2nd - I have a problem:slight_frown: I have Wise-chat-pro plugin on my site, which is really cool, but I am not able to upload pictures directly into chat window it comes up with an Error: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data when debugging enabled. I have contacted the plugin author - he just doesn't reply, I have posted few times on support forum - no one helps me with this topic :slight_frown: I have spent hours on the web looking how to fix this and found an article here I am quite new to the websites and such, I get the point of this article and I understand what to do, but I don't know the most basic thing: I don't know how to locate the file which needs to be amended. I have debugging enabled on my site via wp-config but still, I don't know how to look for an error, what it should look like? Which function in debugging I need to use: whether console, debugging or else when looking for it... Seems so simple, yet complicated if you don't know the coding language... Please, if you could advise me regarding this case. I would be truly very thankful.
Kind regards

  • Adam Czajczyk

    Hello Curious,

    I hope you're well today and thank you for your question!

    Are you using a "lite" (free) version of that plugin or a full paid Pro version? I'm asking this because I can see it's a premium plugin and since you paid for it you should be eligible for full support from the developer. That'd be the best shot as developer usually knows the way his code works best :slight_smile:

    The article you linked to may or may not give a solution for that and even if it does, in order to apply it to the plugin you would need to edit plugin's core files which isn't suggested solution.

    The question though is why that happens. This may be caused by a bug in plugin but may also be caused by other reasons such as e.g. "broken" plugin files or some theme/plugin conflict. I'd suggest starting with this:

    1. Use FTP to re-upload all the files of the plugin to the site in order to make sure that no errors occurred during transfer.

    2. Perform a full plugin/theme conflict test by following all the steps described on a flowchart in this article (you may need to scroll the page down a little) and see where it gets you:

    Meanwhile, it would be good to keep "nagging" developer for help.

    Keep me informed please!

    Best regards,

  • Curious

    HiAdam :slight_smile:
    Thank you very much for your reply :slight_smile:
    Yes, I do use full paid PRO version. I really did contact him via e-mail and I have posted to plugin's support forum with screenshots and possibly everything I could find out along with the full debug message. Nothing in return... I thought too that I am eligible to support, except that not much I have received of it so far, which is a shame...
    I had a free version of that specific plugin before and I had exactly the same issue, thought it's not a big deal since I was only checking it out and knew that I will be purchasing the PRO anyway - expecting that it will be better, yet... I then thought that it may be my theme causing problems - contacted theme's author because it is paid too, gave him access to my site. He checked it out, deactivated the theme, checked it with the default wp theme and got an exactly the same error. So it is definitely the plugin...
    Thank you for the article suggestion, read it all and have done all of the steps previuosly... just that I use cpanel to upload files but process is pretty much the same.
    I have e-mailed him again today with the feedback from my theme's author.
    Anyway, thank you for your advices:slight_smile:
    Kind regards

  • Adam Czajczyk

    Hello Curious!

    I'm really sorry that the developer is ignoring you messages.

    As for the issue. You said that you performed the the conflict test described on a flowchart in an article that I shared with you. Didn't it bring any results? I mean - there was no point at which it started to work?

    If so, it would suggest that this is indeed a bug in a plugin. As yo mentioned that you already experienced that issue with the free version of the chat as well I downloaded it and installed on my end but I wasn't able to replicate this.

    That being said, I'm not able to give you any guarantee of fixing it but I'd like to take a closer look at your setup if you wish. Would you mind granting me a support access to it so I could take a look? To do this, please follow this guide:

    Best regards,

  • Curious

    Emmm, I would be more than happy to grant you an access. Just please don't be get shocked it's quite ... em... naughty :smiley: but it's going to pay for my studies :slight_smile: Have in mind that they are only pictures and some unfinished creative writing :smiley:
    I have, yes - well not really - unless I have missed something. But I've done for so many times, I wouldn't think I have...
    Ok, it's all done.Plug in is on and activated
    So embarrassing.... :smiley:
    Thank you
    Kind regards

  • Dimitris

    Hey there Curious,

    hope you're doing good today and don't mind chiming in! :slight_smile:

    I appreciate that you granted us support access, as I also tried the free version of the plugin and image upload is working as should be.
    I'll keep in mind not to mention your domain name or anything that could make you embarrasing. :slight_smile:

    FIrst, I'd like to show you the errors that I got trying to upload an image.


    SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

    Could you please describe me how did you get this error? Or am I missing something obvious here? Please advise!
    Additionally, as this is an under construction site, I'd advise you to enable WP_DEBUG all the time. You can find a nice article here You can also enable WP_DEBUG_DISPLAY to true, in order for us to see any errors in frontend too. :wink:

    2. In plugins FAQ page is stated the following

    Option "Enable Images" does not work. I see regular hyperlinks instead of images. What is wrong?

    The option requires a few prerequisites in order to operate correctly: GD and Curl extensions must be installed, Media Library must operate correctly, posted image link must have a valid extension (jpg, jpeg, gif or png), HTTP status code of the response must be equal 200, image cannot be larger than 3MB (the default limit that can be adjusted in settings). Try to read PHP logs in case of any problems.

    Could you please your hosting provider asking if these extensions (GD and Curl) are up and running?
    They should be able to provide some more info about the 500 error code too as it's a pretty generic error which doesn't tell us a lot about its origin.

    Media library seems to work, I was able to attach an image from chat window as uploading an image from admin area too. Valid extensions were used in my tests (.png & .jpg) with minimum file size (1-2KB).

    Warm regards,

  • Curious

    Good morning :slight_smile:
    I am well thank you, hope you are well too :slight_smile:
    I am ok, with my own web Dimitris, it's simply very weird to show this to people yet - completely beyond my normal lifestyle standards:smiley: I'll get used to it :slight_smile: Please do not bother yourself with hiding it's links or so, I most honestly appreciate that you guys are trying and being so nice :slight_smile: so far it feels that wpmudev is the second best thing after the BIG BANG - so well mannered people with an excellent approach :slight_smile: Really impressing.
    Regarding the error message: I have enabled debug via wise chat pro first-->Settings-->advanced-->Eneble debug. Then simply tried to upload the image and typed ''debug'' in the chat window. Hit enter and wuola!
    [5/9/2016 20:6:51] [wisechat.engines.AjaxEngine] [onMessageSentError] [responseText] <b>Notice</b>: getimagesize(): Read error! in <b>/home/.../public_html/wp-content/plugins/wise-chat-pro/src/services/WiseChatImagesService.php</b> on line <b>238</b> {“error”:”Unsupported type of file.”}
    [5/9/2016 20:6:51] [wisechat.engines.AjaxEngine] [onMessageSentError] [errorThrown] Bad Request
    [5/9/2016 20:6:51] [wisechat.engines.AjaxEngine] [onMessageSentError] [exception] SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    Yes, media library works fine, the '''File attachment'' buton for the chat window works fine too, just the ''Upload image'' button is what is being a trouble.
    I have also set display_debug on true in wp-config.php just right now, sorry - I thought I have done it yesterday.
    Em, would it be easier for you guys if I will grant you a full access to all of my files and control panels (cPanel, WHM) by leaving access credentials in the plugin message window on my web? ?or I could just type it here - does not bother me at all, since the site is under construction. Just let me know what's the best and I'll do so :slight_smile:
    I have just opened a chat window with my hosting, but from what I gather - I don't think they are installed.
    Thanks so much for all of your help so far :slight_smile:

  • Adam Czajczyk

    Hello Curious!

    Thank you for all these information!

    Em, would it be easier for you guys if I will grant you a full access to all of my files and control panels (cPanel, WHM) by leaving access credentials in the plugin message window on my web? ?or I could just type it here - does not bother me at all, since the site is under construction. Just let me know what's the best and I'll do so

    Yes, that would actually be great and very helpful. Please though do not post such information here ever as this is a publicly available forum and is fairly well indexed by Google and other search engines. Posting access credentials here would cause a serious security risk for your site. You may however safely leave them for us as a "support note" on "WPMU DEV -> Support" page in your site's dashboard. Please however make sure that you keep the support access open, it's time valid and it may expire before we are done with this :slight_smile:

    hosting team is now looking into GD and cURL

    I think, let's wait for their response and see where it gets us. Then, if necessary, we'd make use of a full access and see what we could do. Let me know please about your host replay.

    Best regards,

  • Curious

    So, our chat with hosting has been on for a couple of hrs. They are saying that they can't get it sorted whilst chatting. Opened a ticket but probably it is going to take 2 - 3weeks just as last time, if anyone had to deal with Arvixe before will understand what I am talking about :slight_smile:. Guys, if you can do anything quicker - please do. Do whatever it takes to get it running. Full access granted for you. Credentials are ready too.Thanks so much:slight_smile:
    I am so happy I found this website... :slight_smile:

  • Adam Czajczyk

    Hello Curious!

    Thanks for your response!

    I accessed your site and tested it again. I do actually got a couple of ideas though in order to test them I'd need to access your setup directly. I can see that you left us cPanel login and password in your dashboard which is great but you did not gave us a cPanel URL :slight_smile:

    Could you please add that URL to the note in "WPMU DEV -> Support" page? Let me know here when you're ready :slight_smile:


    Best regards,

  • Adam Czajczyk

    Hello Curious!

    Thanks for updating information.

    I just spend a bit of time testing it all and I found out that the plugin (the Pro version) is working fine on my setup. I also got my colleague test it and he confirms the same. We tested it both with default (Twenty Sixteen in my case) and your theme.

    That means we can rule out a plugin issue and most likely the theme issue unless it's strictly related to the plugin conflict or a server configuration. I know we already talked about it but would you mind if I conduct a full plugin conflict test by myself?

    Before I do this though, I'd like to ask you to sort one more thing out. I noticed that you are using CloudFlare and it seems that the ClourdFlare settings are not correct as the CloudFlare plugin on your site is reporting invalid token.

    Could you please go to "CloudFlare" plugin settings in your site's dashboard an follow suggestions to update it with proper tokens? I mean, I'd like that plugin to be fully operational before I go any further.

    Let me know when you're ready with this, please!

    Best regards,

  • Curious

    Oh, ok - thank you both very much for doing this:slight_smile:
    Yes, please do -by all means:slight_smile: em, regarding CloudFlare plugin - I am not sure what is wrong there. My e-mail is correct, don't know how the token is incorrect but I have disabled and enabled development mode few times from CloudFlare and tried to save new settings on my web - it just wouldn't save it and debug would state the same error. Anyway, I have added CloudFlare credentials to the wpmudev plugin message field. Please do have a look yourself. I allow you to do all necessary changes anywhere, just do your magic and make it work, please:slight_smile:
    I am so sorry, I that I am so incapable to help more...
    Thanks so much for all of your efforts. Truly :slight_smile:

  • Curious

    Hi Predrag,
    No, it is still not sorted - the 'Attach file'' button was never a problem. 'Upload image' ( the one with camera logo) was. Please see the above Adam's message and mine's following. This is where we stopped. I have replied to Adam's message really late and it was Sunday, so couldn't be even more thankful for trying as much as he had over the last few days. But please, by all means - if you will be able to solve this puzzle you are welcome to try :slight_smile:
    Thank you

  • Predrag Dubajic

    Hi Curious,

    Ah, sorry I missed that part :slight_frown:

    I can see the issue now, and when I try with .JPG image it shows error log you mentioned already but with .PNG image it throws server error notification which is really strange.

    I did some reasearch about these issues and it looks like Wise Chat has encountered it couple times before but even they are not sure what the issue is, you can see this thread where author replied just an hour ago:

    There are couple more reports but unfortunately none have solution:

    Perhaps Wise Chat is not playing nicely with certain server configurations, unfortunately it looks like this is something their devs will need to dig deeper into.

    Best regards,

  • Curious

    Hmmm, I don't know anymore... Anyway - plugin's author has replied so I have sent him the link. Maybe he will have an idea. Another developer replied today to my request regarding this specific issue saying: ''JSON.parse issue is because the response is not proper JSON text, but the javascript expects JSON text.
    check the response in the browser.''
    I am so tired of this issue...
    Thank you for your help

  • Dimitris

    Greetings Curious,

    I can understand that bugs can be very annoying for both developers and users, especially in cases where reproduction of these aren't always possible, like mine and Adam cases at least, who tried to replicate this without success.
    Please, feel free to post back here if any kind of solution is provided to you by plugin authors in order for other members to take advantage of it. :slight_smile:

    Take care,

  • Curious

    Thanks Dimitris,

    I know it is complicated for you too and I genuinely think that you guys are all super, just really, really draining to be close to finish but not being able to move on.... Um, anyway: If any of you wouldn't mind - could you have a look at the apache error log and see if you will see any related errors, please? Also - since I am so raw - could you please send me a screenshot of the server response in regards to this error? (just please, please be very discreet not to give away my web URL in screenshots) I can image - that you want to yell at me for not knowing such things/basics :smiley: I know, I know... Gosh, definitely signing up for a course whenever there will be spare time... And, I am so, so sorry to be such pain...

    Thank you very much

  • Dimitris

    Greetings Curious,

    hope you're having a beautiful day! You're no pain at all! :slight_smile:

    If any of you wouldn't mind - could you have a look at the apache error log and see if you will see any related errors, please?

    Unfortunately, there's only a PHP notice in there, no errors or warnings. :slight_frown:
    [10-Sep-2016 19:47:47 UTC] PHP Notice: Undefined variable: json in /xxxx/xxxxxxxx/public_html/wp-content/plugins/wise-chat-pro/wise-chat-core.php on line 55

    Kind regards,

  • Curious

    Hi Dimitris,
    Thank you so much
    oh, that was me in line 55, but all fixed :slight_smile:
    Would you do me another massive favour please, you know you found this error which you have posted on Sun Sep 11 2016, 10:54:37 AM with screenshot attachments? Could you please check the response of the browser to this error. I was trying to do that but don't understand what I am looking at... :slight_smile:
    Thanks so much

  • Dimitris

    Hey Curious,

    the Chat plugin debug is throwing:
    [15/9/2016 17:5:2] [wisechat.engines.AjaxEngine] [onMessageSentError] [responseText] <b>Notice</b>: getimagesize(): Read error! in <b>/home/serve258/public_html/wp-content/plugins/wise-chat-pro/src/services/WiseChatImagesService.php</b> on line <b>238</b> {"error":"Unsupported type of file."}
    [15/9/2016 17:5:2] [wisechat.engines.AjaxEngine] [onMessageSentError] [errorThrown]
    [15/9/2016 17:5:2] [wisechat.engines.AjaxEngine] [onMessageSentError] [exception] SyntaxError: Unexpected token < in JSON at position 0

    while the response is

    <br />
    <b>Notice</b>:  getimagesize(): Read error! in <b>/home/serve258/public_html/wp-content/plugins/wise-chat-pro/src/services/WiseChatImagesService.php</b> on line <b>238</b><br />
    {"error":"Unsupported type of file."}

    Take care,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.