Make WordPress Core


Ignore:
Timestamp:
06/11/2024 12:36:13 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Administration: Remove redundant type casting in WP_List_Table::search_box().

Scalar values passed to esc_attr() are already converted internally to a string via both wp_check_invalid_utf8() and _wp_specialchars().

Includes adding @covers tags for unit tests.

Follow-up to [58379].

See #58379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r58379 r58389  
    391391                        if ( is_array( $_REQUEST['orderby'] ) ) {
    392392                                foreach ( $_REQUEST['orderby'] as $key => $value ) {
    393                                         /*
    394                                          * Orderby can be either an associative array or non-associative array.
    395                                          * In the latter case, this makes sure the key is a string before calling esc_attr().
    396                                          */
    397                                         $key = (string) $key;
    398393                                        echo '<input type="hidden" name="orderby[' . esc_attr( $key ) . ']" value="' . esc_attr( $value ) . '" />';
    399394                                }
Note: See TracChangeset for help on using the changeset viewer.