Skip to content

Commit 4ce25a5

Browse files
Coding Standards: Remove extra check in WP_REST_Server::get_json_last_error().
`json_last_error()` can only return an integer, and the `JSON_ERROR_NONE` constant has the value of `0`, so the `empty()` check is redundant here. Follow-up to [34928], [46206]. Props dilipbheda, audrasjb, SergeyBiryukov. See #63249. git-svn-id: https://develop.svn.wordpress.org/trunk@60151 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a04a13a commit 4ce25a5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/wp-includes/rest-api/class-wp-rest-server.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,7 @@ protected function respond_to_request( $request, $route, $handler, $response ) {
13391339
* @return false|string Boolean false or string error message.
13401340
*/
13411341
protected function get_json_last_error() {
1342-
$last_error_code = json_last_error();
1343-
1344-
if ( JSON_ERROR_NONE === $last_error_code || empty( $last_error_code ) ) {
1342+
if ( JSON_ERROR_NONE === json_last_error() ) {
13451343
return false;
13461344
}
13471345

0 commit comments

Comments
 (0)