Title: PHP Warning:  json_encode error
Last modified: August 30, 2016

---

# PHP Warning: json_encode error

 *  Resolved [WebKJGor](https://wordpress.org/support/users/webkjgor/)
 * (@webkjgor)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/)
 * Hi,
 * Been getting this in root error log when doing stuff in admin:
 * [11-Aug-2015 01:49:51 UTC] PHP Warning: json_encode() [[function.json-encode](https://wordpress.org/support/topic/php-warning-json_encode-error/function.json-encode?output_format=md)]:
   Invalid UTF-8 sequence in argument in /home/XXXXX/public_html/wp-content/plugins/
   ewww-image-optimizer/aux-optimize.php on line 659
 * [https://wordpress.org/plugins/ewww-image-optimizer/](https://wordpress.org/plugins/ewww-image-optimizer/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419643)
 * I wonder if it’s getting an empty array when doing a scheduled optimize. Can 
   you post your debug information from the settings page (turn on the debug option,
   and then look at the bottom of the page).
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419671)
 * Try the dev version, and see if that eliminates the errors: [https://downloads.wordpress.org/plugin/ewww-image-optimizer.zip](https://downloads.wordpress.org/plugin/ewww-image-optimizer.zip)
 * After install, you should see version 2.5.0.2
 *  Thread Starter [WebKJGor](https://wordpress.org/support/users/webkjgor/)
 * (@webkjgor)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419683)
 * I think the errors may be caused with images that have weird filenames. Is it
   possible to track down which images those are so that I can rename them?
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419685)
 * Pretty much any filename should be capable of being in the utf8 encoding, so 
   that seems unlikely, but I guess it IS possible. I’ll have to dream up a way 
   to track it down though, since nothing comes to mind right off hand.
 * When you turn on the debugging option, it dumps output to a file named debug.
   log in the ewww-image-optimizer plugin folder, but I don’t know quite how we 
   would track down an invalid utf8 sequence from there. It ought to log all the
   files it scanned (and found), but there wouldn’t necessarily be anything to indicate
   a utf8 problem. But maybe just seeing the list of files would be enough for you,
   so I thought I’d mention it.
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419732)
 * I’ve also implemented a fix for passing empty values to json_encode(). Are you
   still encountering the problem? If so try a fresh copy from the dev link, version
   2.5.0.6
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419733)
 * Nevermind the “fix”, it seems that some characters CAN trigger this error, even
   if they ARE proper utf8. Other than scanning the debug log, I don’t know how 
   else you would find the problem image.
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419752)
 * I’m doing a bit of a rebuild on the Scan & Optimize that should resolve this 
   sort of issue. Be on the lookout for the fix in the next couple weeks.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘PHP Warning: json_encode error’ is closed to new replies.

 * ![](https://ps.w.org/ewww-image-optimizer/assets/icon-256x256.png?rev=1582276)
 * [EWWW Image Optimizer](https://wordpress.org/plugins/ewww-image-optimizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ewww-image-optimizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ewww-image-optimizer/)
 * [Active Topics](https://wordpress.org/support/plugin/ewww-image-optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ewww-image-optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ewww-image-optimizer/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/php-warning-json_encode-error/#post-6419752)
 * Status: resolved