Make WordPress Core

Ticket #56754: 56754.diff

File 56754.diff, 2.1 KB (added by viralsampat, 21 months ago)

I have added condition and resolved PHPCS errors.

  • src/wp-admin/includes/taxonomy.php

    diff --git a/src/wp-admin/includes/taxonomy.php b/src/wp-admin/includes/taxonomy.php
    index 2326e9eb50..18d711b116 100644
    a b function wp_insert_category( $catarr, $wp_error = false ) { 
    186186 * @return int|false The ID number of the new or updated Category on success. Zero or FALSE on failure.
    187187 */
    188188function wp_update_category( $catarr ) {
    189         $cat_ID = (int) $catarr['cat_ID'];
     189        $cat_id = (int) $catarr['cat_ID'];
    190190
    191         if ( isset( $catarr['category_parent'] ) && ( $cat_ID == $catarr['category_parent'] ) ) {
    192                 return false;
     191        // Check that cat_id isset and not empty.
     192        if( isset( $cat_id ) && !empty( $cat_id ) ) {
     193                if ( isset( $catarr['category_parent'] ) && ( $cat_id == $catarr['category_parent'] ) ) {
     194                        return false;
     195                }
    193196        }
    194 
     197       
    195198        // First, get all of the original fields.
    196         $category = get_term( $cat_ID, 'category', ARRAY_A );
     199        $category = get_term( $cat_id, 'category', ARRAY_A );
    197200        _make_cat_compat( $category );
    198201
    199202        // Escape data pulled from DB.
  • src/wp-admin/includes/user.php

    diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
    index 134da30514..284084c09c 100644
    a b Please click the following link to activate your user account: 
    621621function wp_is_authorize_application_password_request_valid( $request, $user ) {
    622622        $error = new WP_Error();
    623623
     624        // Check that $request is empty ot not.
    624625        if ( ! empty( $request['success_url'] ) ) {
    625626                $scheme = wp_parse_url( $request['success_url'], PHP_URL_SCHEME );
    626627
    function wp_is_authorize_application_password_request_valid( $request, $user ) { 
    632633                }
    633634        }
    634635
     636        // Check that $request is empty ot not.
    635637        if ( ! empty( $request['reject_url'] ) ) {
    636638                $scheme = wp_parse_url( $request['reject_url'], PHP_URL_SCHEME );
    637639
    function wp_is_authorize_application_password_request_valid( $request, $user ) { 
    643645                }
    644646        }
    645647
     648        // Check that $request is empty ot not and check that app id is uuid or not.
    646649        if ( ! empty( $request['app_id'] ) && ! wp_is_uuid( $request['app_id'] ) ) {
    647650                $error->add(
    648651                        'invalid_app_id',