REST API: add `JsonSerializable()` compatibility interface for PHP <5.4 to `compat.php`

Props rmmcue.
See #33982.

Built from https://develop.svn.wordpress.org/trunk@34845


git-svn-id: http://core.svn.wordpress.org/trunk@34810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-10-06 02:56:24 +00:00
parent 5a357a452f
commit f8c3aca01c
2 changed files with 18 additions and 2 deletions

View File

@ -315,4 +315,20 @@ if ( ! function_exists( 'json_last_error_msg' ) ) :
return 'An unknown error occurred';
}
}
endif;
endif;
if ( ! interface_exists( 'JsonSerializable' ) ) {
define( 'WP_JSON_SERIALIZE_COMPATIBLE', true );
/**
* JsonSerializable interface.
*
* Compatibility shim for PHP <5.4
*
* @link http://php.net/jsonserializable
*
* @since 4.4.0
*/
interface JsonSerializable {
public function jsonSerialize();
}
}

View File

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