[wp-trac] [WordPress Trac] #41725: User Search Box disappears if searched with 0 (zero)

WordPress Trac noreply at wordpress.org
Fri Aug 25 11:44:14 UTC 2017


#41725: User Search Box disappears if searched with 0 (zero)
------------------------------+-----------------------------
 Reporter:  subrataemfluence  |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Users             |    Version:  4.8.1
 Severity:  normal            |   Keywords:
  Focuses:  administration    |
------------------------------+-----------------------------
 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
 <?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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41725>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list