REST API: Only provide JSON error code on PHP 5.3+.
json_last_error() was only added to PHP 5.3.0, so we can't provide the information for older versions. See #38547. Built from https://develop.svn.wordpress.org/trunk@39111 git-svn-id: http://core.svn.wordpress.org/trunk@39053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
63ba4592e1
commit
721cf281a3
|
@ -683,9 +683,12 @@ class WP_REST_Request implements ArrayAccess {
|
|||
|
||||
$error_data = array(
|
||||
'status' => WP_Http::BAD_REQUEST,
|
||||
'json_error_code' => json_last_error(),
|
||||
'json_error_message' => json_last_error_msg(),
|
||||
);
|
||||
if ( function_exists( 'json_last_error' ) ) {
|
||||
$error_data['json_error_code'] = json_last_error();
|
||||
$error_data['json_error_message'] = json_last_error_msg();
|
||||
}
|
||||
|
||||
return new WP_Error( 'rest_invalid_json', __( 'Invalid JSON body passed.' ), $error_data );
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-beta1-39110';
|
||||
$wp_version = '4.7-beta1-39111';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue