Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#41725 new defect (bug)

User Search Box disappears if searched with 0 (zero)

Reported by: subrataemfluence's profile subrataemfluence Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.1
Component: Users Keywords: has-patch
Focuses: administration Cc:

Description

If I search users with "0" in search box, the search box disappears after the search is performed and there is no way of doing another search without reloading user list or going back!

If I enter any other value like 999999, -200, xyz etc. no user is fetched, which is fine. But the search box remains visible. It only disappears for 0.

Line nos. 347 and 348 in /wp-admin/includes/class-wp-list-table.php has this:

<?php
public function search_box( $text, $input_id ) {
   if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
      return;
   ...
}

If I understand correctly, according to https://developer.wordpress.org/reference/classes/wp_list_table/search_box/ and https://developer.wordpress.org/reference/classes/wp_list_table/has_items/, (&& !$this->has_items()) looks whether the table has items to display or not, where the first link is responsible for rendering the search_box.

So when I enter such a value for which there will no record fetched, should not render the search box after search is performed, but as I said, it is happening only for 0

Commenting out the above if block prevents search box from disappearing. The search box should remain visible irrespective of values entered into it.

Attachments (3)

search-box-visible-for-non-zero-input.jpg (20.5 KB) - added by subrataemfluence 7 years ago.
Search box is visible with search keyword other than zero (0)
search-box-disappears-with-zero.jpg (20.8 KB) - added by subrataemfluence 7 years ago.
Search box is disappeared when searched with zero (0)
41725.diff (526 bytes) - added by subrataemfluence 7 years ago.

Download all attachments as: .zip

Change History (7)

@subrataemfluence
7 years ago

Search box is visible with search keyword other than zero (0)

@subrataemfluence
7 years ago

Search box is disappeared when searched with zero (0)

#1 @subrataemfluence
7 years ago

  • Keywords needs-patch added

#2 @subrataemfluence
7 years ago

  • Keywords has-patch added; needs-patch removed

#3 follow-up: @SergeyBiryukov
7 years ago

Previously: #31025

#4 in reply to: ↑ 3 @subrataemfluence
7 years ago

Hi, thanks for guiding me to the previous ticket (#31025). Seems the issue is still not resolved!
Replying to SergeyBiryukov:

Previously: #31025

Note: See TracTickets for help on using tickets.