oEmbed: if SimpleXMLElement does not exist, return an HTTP Error 501 Not implemented response.

Props swissspidy.
Fixes #34274.


git-svn-id: https://develop.svn.wordpress.org/trunk@35354 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-10-22 16:37:31 +00:00
parent ff49cc7ebf
commit a19a0e6e72
3 changed files with 13 additions and 5 deletions

View File

@@ -142,12 +142,17 @@ final class WP_oEmbed_Controller {
* @return string The XML response data.
*/
public function xml_response( $data ) {
if ( ! class_exists( 'SimpleXMLElement' ) ) {
status_header( 501 );
return get_status_header_desc( 501 );
}
$result = _oembed_create_xml( $data );
// Bail if there's no XML.
if ( ! $result ) {
status_header( 501 );
return 'Not implemented';
return get_status_header_desc( 501 );
}
if ( ! headers_sent() ) {