RealFaviconGenerator / realfavicongenerator

Generate favicon for all major platforms
501 stars 24 forks source link

Wordpress plug in error: JSON could not be parsed. Check your syntax. #68

Open twelch555 opened 10 years ago

twelch555 commented 10 years ago

I'm getting this error from the realfavicongenerator website if I try and do anything with the plug in: select media file button or generate.

Error: JSON could not be parsed. Check your syntax.

Plugin version 1.2.1

WP 3.9.2

phbernard commented 10 years ago

Do you have the ability to get the posted JSON document with your favorite browser's developer console?

json

Else, could you tell me the URL of your blog? (eg. http://mysite.com/myblog/) I suspect it may contain a special character, although that should not happen.

twelch555 commented 10 years ago

Hi thanks for your speedy reply. I had a look in the console and there is nothing in the Form Data listing on the favicon_generator post object.

I thought it might be theme interference so I reverted to a default wordpress theme, no change in behavior.

I have another theory about what the issue may be. I am developing the site locally at the moment with a local url redirect (using what the final site url will be) in the hosts file. Is it possible the favicon_generator website is putting up an error because it cannot find its way back to the requesting site? If that is the case then I'll wait until I've got the site up and sort the favicons out then.

Another bit of information, I get the error whether I put a path in the path box or not and also if I click the use file from media library button.

So, it seems like it is not liking my development environment.

Another item of note, I get the following console notes when I load the favicon admin page in wordpress

Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: print, not all, (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) themes.php?page=favicon-by-realfavicongenerator/admin/class-favicon-by-realfavicongenerator-admin.p…:1 Uncaught SyntaxError: Unexpected token ILLEGAL themes.php?page=favicon-by-realfavicongenerator/admin/class-favicon-by-realfavicongenerator-admin.p…:244 'Attr.nodeValue' is deprecated. Please use 'value' instead.

Thanks for the follow up.

Troy Welch


From: Philippe Bernard (notifications@github.com)mailto:Philippe%20Bernard%20(notifications@github.com) Sent: Wednesday, August 27, 2014 09:50 AM To: RealFaviconGenerator/realfavicongenerator (realfavicongenerator@noreply.github.com)mailto:RealFaviconGenerator/realfavicongenerator%20(realfavicongenerator@noreply.github.com) Cc: twelch555 (twelch@tru.ca)mailto:twelch555%20(twelch@tru.ca) Subject: Re: [realfavicongenerator] Wordpress plug in error: JSON could not be parsed. Check your syntax. (#68)

Do you have the ability to get the posted JSON document with your favorite browser's developer console?

[json]https://cloud.githubusercontent.com/assets/423852/4063717/269d85d4-2e0a-11e4-97dc-2c318f447f18.png

Else, could you tell me the URL of your blog? (eg. http://mysite.com/myblog/) I suspect it may contain a special character, although that should not happen.

— Reply to this email directly or view it on GitHubhttps://github.com/RealFaviconGenerator/realfavicongenerator/issues/68#issuecomment-53603845.

phbernard commented 10 years ago

Adding a line to your hostfile should work (I also do this all the time, so useful!), except when you specify a master picture from your media library. But you get the same error when you set one, so this is not the problem. Plus you should get a different error message (something like "Cannot download picture http:///siteunderdev.com/mypic.png"). So this issue must not come from the hostfile.

But you mention that the form data listing is empty? This is strange... and a likely suspect. What is your browser? Could you try with another one just in case? (at least it should work with Chrome).

twelch555 commented 10 years ago

I'm using chrome, also tried Firefox, no go on either.

I'll give a couple of other thing a try: -uninstall and reinstall plugin -try installing in a sandbox site

These might narrow down environment vs site-specific issues. (We'll the second one might anyway.

Troy

Troy Welch Lecturer, Digital Art & Design Thompson Rivers University Kamloops, B.C. Canada


On Thursday, August 28, 2014 01:22 PM, Philippe Bernard notifications@github.com<mailto:notifications@github.com> wrote:

Adding a line to your hostfile should work (I also do this all the time, so useful!), except when you specify a master picture from your media library. But you get the same error when you set one, so this is not the problem. Plus you should get a different error message (something like "Cannot download picture http:///siteunderdev.com/mypic.png"). So this issue must not come from the hostfile.

But you mention that the form data listing is empty? This is strange... and a likely suspect. What is your browser? Could you try with another one just in case? (at least it should work with Chrome).

— Reply to this email directly or view it on GitHubhttps://github.com/RealFaviconGenerator/realfavicongenerator/issues/68#issuecomment-53791719.

phbernard commented 10 years ago

Really, really weird.

Just to make sure, are we talking of the same "favicon_generator" request? Because it appears twice in the Chrome's console.

twelch555 commented 10 years ago

There are two together, I'm assuming it is the one with the POST request method you are after. The complete output of that one below.

(Neither reinstalling or trying the sandbox site worked)

I'm guessing then, that it must be some aspect of my overall environment.

What I find interesting (assuming I'm understanding the operation correctly) is that you can do one of two or three things: 1) supply an url for the image, press Generate and be taken to the website to for further decisions 2) press the Select from media library button which I assume would pop open Wordpress' media selection interface to select an image before proceeding 3) press the Generate button directly and select the image from the website for further processing

All three of these options open the website and deliver the error (although things may differ under the hood.)

Hope this helps.

T


1. Remote Address: 91.236.239.25:80 2. Request URL: http://realfavicongenerator.net/api/favicon_generator 3. Request Method: POST 4. Status Code:

302 Found

  1. Request Headersview source Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-GB,en-US;q=0.8,en;q=0.6 Cache-Control: max-age=0 Connection: keep-alive Content-Length: 32 Content-Type: application/x-www-form-urlencoded Cookie: utma=227640606.621044771.1408736829.1408736829.1408984610.2; utmc=227640606; __utmz=227640606.1408736829.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); PHPSESSID=jptig1g24vokadqaaovens6eo6; _ga=GA1.2.621044771.1408736829; __atuvc=1%7C34%2C44%7C35 Host: realfavicongenerator.net Origin: http://twsandbox Referer: http://twsandbox/wp-admin/themes.php?page=favicon-by-realfavicongenerator/admin/class-favicon-by-realfavicongenerator-admin.phpfavicon_settings_menu User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
  2. Form Dataview sourceview URL encoded * json_params:

    * master_picture_url:

  3. Response Headersview source Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: Keep-Alive Content-Encoding: gzip Content-Length: 20 Content-Type: text/html Date: Thu, 28 Aug 2014 20:45:09 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=5, max=100 Location: /api/favicon_generator Pragma: no-cache Server: Apache/2.2.22 (Ubuntu) Vary: Accept-Encoding * X-Powered-By: PHP/5.3.10-1ubuntu3.13

Troy


From: Philippe Bernard (notifications@github.com)mailto:Philippe%20Bernard%20(notifications@github.com) Sent: Thursday, August 28, 2014 01:42 PM To: RealFaviconGenerator/realfavicongenerator (realfavicongenerator@noreply.github.com)mailto:RealFaviconGenerator/realfavicongenerator%20(realfavicongenerator@noreply.github.com) Cc: twelch555 (twelch@tru.ca)mailto:twelch555%20(twelch@tru.ca) Subject: Re: [realfavicongenerator] Wordpress plug in error: JSON could not be parsed. Check your syntax. (#68)

Really, really weird.

Just to make sure, are we talking of the same "favicon_generator" request? Because it appears twice in the Chrome's console.

— Reply to this email directly or view it on GitHubhttps://github.com/RealFaviconGenerator/realfavicongenerator/issues/68#issuecomment-53794691.