Making WordPress.org


Ignore:
Timestamp:
01/08/2015 06:53:48 PM (10 years ago)
Author:
iandunn
Message:

Central Theme: Make sure that the Twitter API response is an array.

If the request fails because of authentication then json_decode() will return null. That previously passed the success checks on the server and client sides, and resulted in empty output with no indication to the user that something went wrong.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/functions.php

    r1105 r1106  
    469469                 * so we have to request more tweets than we actually want and then cut it down here.
    470470                 */
    471                 if ( $tweets['tweets'] ) {
     471                if ( is_array( $tweets['tweets'] ) ) {
    472472                    $tweets['tweets']      = array_slice( $tweets['tweets'], 0, 3 );
    473473                    $tweets['tweets']      = self::sanitize_format_tweets( $tweets['tweets'] );
Note: See TracChangeset for help on using the changeset viewer.