WordPress.org

Make WordPress Core

Ticket #16748: 16748-2.diff

File 16748-2.diff, 776 bytes (added by ericmann, 7 years ago)
  • xmlrpc.php

     
    9898if ( isset($HTTP_RAW_POST_DATA) )
    9999        logIO("I", $HTTP_RAW_POST_DATA);
    100100
     101function xmlrpc_die_handler( $message, $title = '', $args = array() ) {
     102        global $wp_xmlrpc_server;
     103
     104        if ( $wp_xmlrpc_server ) {
     105                $error = new IXR_Error(500, $message);
     106                $wp_xmlrpc_server->output( $error->getXml() );
     107        }
     108}
     109
     110add_filter( 'wp_die_handler', function( $handler ) { return 'xmlrpc_die_handler'; } );
     111
    101112// Allow for a plugin to insert a different class to handle requests.
    102113$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
    103114$wp_xmlrpc_server = new $wp_xmlrpc_server_class;