Make WordPress Core

Changeset 21701


Ignore:
Timestamp:
09/03/2012 09:42:24 PM (14 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().

see #20246.
for trunk.

File:
1 edited

Legend:

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

    r20874 r21701  
    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.