[wp-trac] [WordPress Trac] #28807: json_encode result checking in plugin updater

WordPress Trac noreply at wordpress.org
Thu Jul 10 11:35:18 UTC 2014


#28807: json_encode result checking in plugin updater
-----------------------------+-----------------------------
 Reporter:  Patricy          |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  3.9.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 '''wp-includes/udpate.php''' has API request generating from line 266

 {{{
 $options = array(
 ...
                 'body' => array(
                         'plugins'      => json_encode( $to_send ),
                         'translations' => json_encode( $translations ),
                         'locale'       => json_encode( $locales ),
                 ),
 ...
 }}}

 If  plugins array $to_send contain non-UTF symbols
 (you can check i.e. on this plugin [http://wordpress.org/plugins/tinymce-
 and-tinymce-advanced-professsional-formats-and-styles], where author name
 is "David Stöckl")  json_encode function return false (instead of throwing
 error in log) and WP sending empty line to API and got error response.
 {{{
 $options[body][plugins]
 }}}



 As debug I put json_last_error/json_last_error_msg functions and getting
 "JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly"
 error.

 I think extra checks needed after json_encode functions and before sending
 request.
 I got this issue on plugins update checking but sure its possible on
 themes also.

 Related issue https://bugs.php.net/bug.php?id=47494 - not a bug

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28807>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list