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:
parent
51b4e75afb
commit
d2bb4d6745
@ -315,4 +315,20 @@ if ( ! function_exists( 'json_last_error_msg' ) ) :
|
|||||||
return 'An unknown error occurred';
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user