Make WordPress Core

Changeset 21711


Ignore:
Timestamp:
09/03/2012 11:25:58 PM (12 years ago)
Author:
nacin
Message:

Fix oEmbed when the provider only supports XML responses.

[20539] removed string casts that would have taken place on SimpleXMLElement
objects, which implement toString. Instead, convert the SimpleXMLElement object
to a stdClass object before we leave _parse_xml(), for consistency with the
simple object returned from _parse_json().

fixes #20246.
for the 3.4 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.4/wp-includes/class-oembed.php

    r20874 r21711  
    214214            $data = simplexml_load_string( $response_body );
    215215            libxml_use_internal_errors( $errors );
    216             if ( is_object( $data ) )
    217                 return $data;
     216            if ( ! is_object( $data ) )
     217                return false;
     218
     219            $return = new stdClass;
     220            foreach ( $data as $key => $value )
     221                $return->$key = (string) $value;
     222
     223            return $return;
    218224        }
    219225        return false;
Note: See TracChangeset for help on using the changeset viewer.