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

Props rmmcue.
See #33982.


git-svn-id: https://develop.svn.wordpress.org/trunk@34845 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-10-06 02:55:43 +00:00
parent 51b4e75afb
commit d2bb4d6745
1 changed files with 17 additions and 1 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();
}
}