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.
Built from https://develop.svn.wordpress.org/trunk@58389


git-svn-id: http://core.svn.wordpress.org/trunk@57838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-06-11 12:38:14 +00:00
parent 0ed09d9b4b
commit 6e3516b1b6
2 changed files with 1 additions and 6 deletions

View File

@ -390,11 +390,6 @@ class WP_List_Table {
if ( ! empty( $_REQUEST['orderby'] ) ) { if ( ! empty( $_REQUEST['orderby'] ) ) {
if ( is_array( $_REQUEST['orderby'] ) ) { if ( is_array( $_REQUEST['orderby'] ) ) {
foreach ( $_REQUEST['orderby'] as $key => $value ) { foreach ( $_REQUEST['orderby'] as $key => $value ) {
/*
* Orderby can be either an associative array or non-associative array.
* In the latter case, this makes sure the key is a string before calling esc_attr().
*/
$key = (string) $key;
echo '<input type="hidden" name="orderby[' . esc_attr( $key ) . ']" value="' . esc_attr( $value ) . '" />'; echo '<input type="hidden" name="orderby[' . esc_attr( $key ) . ']" value="' . esc_attr( $value ) . '" />';
} }
} else { } else {

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-beta1-58388'; $wp_version = '6.6-beta1-58389';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.