Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#28807 closed defect (bug) (duplicate)

json_encode result checking in plugin updater

Reported by: patricy's profile Patricy Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Plugins Keywords:
Focuses: administration Cc:


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, 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.


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 - not a bug

Change History (7)

#1 @Patricy
10 years ago

but better solution probably could be extra plugins array handling (symbols escaping etc)

#2 @ocean90
10 years ago

Related: #28786

#3 @SergeyBiryukov
10 years ago

  • Component changed from Upgrade/Install to Plugins
  • Focuses administration added
  • Milestone changed from Awaiting Review to 4.0

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.

10 years ago

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.

10 years ago

#6 @DrewAPicture
10 years ago

  • Keywords needs-patch good-first-bug added

We're getting pretty close to the point where this will have to be punted, so if somebody would like to create a patch, that would move this along.

#7 @DrewAPicture
10 years ago

  • Keywords needs-patch good-first-bug removed
  • Milestone 4.0 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Strike that, reverse it. Going to close this as a duplicate of #28786, as both serve to handle non-UTF-8 failures with json_encode().

Note: See TracTickets for help on using tickets.