use maybe_unserialize() in update and API checks, Tighten up the checks on expected return data to avoid processing invalid responses after change. See #19617

git-svn-id: https://develop.svn.wordpress.org/trunk@19707 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2012-01-08 03:48:05 +00:00
parent 921ba280d2
commit 3ff2213c55
3 changed files with 15 additions and 14 deletions
+3 -3
View File
@@ -45,9 +45,9 @@ function plugins_api($action, $args = null) {
if ( is_wp_error($request) ) {
$res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() );
} else {
$res = unserialize( wp_remote_retrieve_body( $request ) );
if ( false === $res )
$res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) );
$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
if ( ! is_object( $res ) && ! is_array( $res ) )
$res = new WP_Error('plugins_api_failed', __('An unknown error occurred during the API request.'), wp_remote_retrieve_body( $request ) );
}
} elseif ( !is_wp_error($res) ) {
$res->external = true;