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.



git-svn-id: http://core.svn.wordpress.org/trunk@21701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-03 21:42:24 +00:00
parent 55e3541896
commit e984c7294d
1 changed files with 8 additions and 2 deletions

View File

@ -213,8 +213,14 @@ class WP_oEmbed {
$errors = libxml_use_internal_errors( 'true' ); $errors = libxml_use_internal_errors( 'true' );
$data = simplexml_load_string( $response_body ); $data = simplexml_load_string( $response_body );
libxml_use_internal_errors( $errors ); libxml_use_internal_errors( $errors );
if ( is_object( $data ) ) if ( ! is_object( $data ) )
return $data; return false;
$return = new stdClass;
foreach ( $data as $key => $value )
$return->$key = (string) $value;
return $return;
} }
return false; return false;
} }