REST API: Don’t display errors during REST API requests.

Uses `wp_debug_mode()` to prevent response from being broken by debug errors. Matches similar behavior of the XML-RPC API.

Props rockwell15.

Fixes #34915.
Built from https://develop.svn.wordpress.org/trunk@36530


git-svn-id: http://core.svn.wordpress.org/trunk@36497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Rachel Baker 2016-02-16 01:36:25 +00:00
parent 796f0c844c
commit 85e82cf571
2 changed files with 3 additions and 2 deletions

View File

@ -300,8 +300,9 @@ function wp_debug_mode() {
} else {
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
}
if ( defined( 'XMLRPC_REQUEST' ) )
if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) ) {
ini_set( 'display_errors', 0 );
}
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36529';
$wp_version = '4.5-alpha-36530';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.