Ticket #23017: 23017.diff

File 23017.diff, 920 bytes (added by koke, 5 months ago)
Line 
1Index: xmlrpc.php
2===================================================================
3--- xmlrpc.php  (revision 23185)
4+++ xmlrpc.php  (working copy)
5@@ -28,6 +28,8 @@
6 /** Include the bootstrap for setting up WordPress environment */
7 include('./wp-load.php');
8 
9+add_action( 'shutdown', 'xmlrpc_shutdown' );
10+
11 if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
12 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
13 ?>
14@@ -83,4 +85,13 @@
15        _deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
16        if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
17                error_log( $io . ' - ' . $msg );
18-}
19\ No newline at end of file
20+}
21+
22+function xmlrpc_shutdown() {
23+       $error = error_get_last();
24+       if ( $error !== NULL && E_ERROR == $error['type'] ) {
25+               ob_clean();
26+               $message = sprintf( '"%s" in %s:%d', $error['message'], $error['file'], $error['line'] );
27+               wp_die( $message );
28+       }
29+}