Make WordPress Core


Ignore:
Timestamp:
04/11/2025 07:36:09 PM (16 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r59880 r60151  
    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                }
Note: See TracChangeset for help on using the changeset viewer.