Ticket #1579: 1579-fix-plugin-object-type.diff
File 1579-fix-plugin-object-type.diff, 1.2 KB (added by , 8 years ago) |
---|
-
standalone/class-plugins-info-api.php
119 119 if ( !empty( $fields['bare_contributors'] ) ) { 120 120 $contribs = $response['contributors']; 121 121 $response['contributors'] = array(); 122 foreach ( $contribs as $user => $data ) { 123 $response['contributors'][ $user ] = $data['profile']; 122 if ( is_array( $contribs ) ) { 123 foreach ( $contribs as $user => $data ) { 124 $response['contributors'][ $user ] = $data['profile']; 125 } 124 126 } 125 127 } 126 128 … … 158 160 $response['plugins'][ $i ] = $this->plugin_information( new Plugins_Info_API_Request( array( 'slug' => $plugin_slug, 'locale' => $request->locale ) ), true ); 159 161 } 160 162 161 // Trim fields 163 // Trim fields and cast to object 162 164 foreach ( $response['plugins'] as $i => $plugin_data ) { 163 $response['plugins'][$i] = $this->remove_unexpected_fields( $plugin_data, $request, 'query_plugins' );165 $response['plugins'][$i] = (object) $this->remove_unexpected_fields( $plugin_data, $request, 'query_plugins' ); 164 166 } 165 167 166 168 $this->output( $response );