WordPress.org

Making WordPress.org

Changeset 3805


Ignore:
Timestamp:
08/12/2016 06:35:22 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Fix the return types for the PHP API to be compatible with the previous return behaviour.

Props tellyworth.
See #1579.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php

    r3554 r3805  
    120120            $contribs = $response['contributors'];
    121121            $response['contributors'] = array();
    122             foreach ( $contribs as $user => $data ) {
    123                 $response['contributors'][ $user ] = $data['profile'];
     122            if ( $contribs ) {
     123                foreach ( $contribs as $user => $data ) {
     124                    $response['contributors'][ $user ] = $data['profile'];
     125                }
    124126            }
    125127        }
     
    159161        }
    160162
    161         // Trim fields
     163        // Trim fields and cast to object
    162164        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' );
    164166        }
    165167
Note: See TracChangeset for help on using the changeset viewer.