#31025 closed defect (bug) (fixed)
Searching by 0 (zero produces inconsistent results)
Reported by: | jadpm | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | has-patch has-unit-tests good-first-bug commit |
Focuses: | administration | Cc: |
Description
Related to #11330
Searching by zero produces inconsistent results, both in the backend on edit.php pages and in frontend:
- In the backend, the 0 is kept on the search input, no search term message is shown and no filtering is done.
- In the frontend, the search results page is loaded, the search term is displayed if your theme provides it and again no filtering is done.
I have no patch ATM, this is a query issue and I am a newbie here, so any help is welcome.
Attachments (3)
Change History (12)
#2
@
9 years ago
- Keywords has-patch has-unit-tests added
- Milestone changed from Awaiting Review to Future Release
#3
@
9 years ago
- Focuses administration added
- Keywords needs-refresh good-first-bug added
Patch needs a slight refresh as I think this is still of value.
#4
@
9 years ago
- Milestone changed from Future Release to 4.5
Thanks, @swissspidy.
The WP_Query
test passes even without the patch :) We've got to throw a non-matching post in there to show that s=0
doesn't return it.
Also, isset( $q['s'] )
will always be true, because of fill_query_vars()
. This will cause LIKE
clauses to be added to every WP_Query
request. Let's use strlen()
instead.
#6
@
9 years ago
- Owner set to swissspidy
- Status changed from new to assigned
wp-admin changes look good to me, though I think we need a refresh on at least one of the files. I'll give you the honors.
#7
@
9 years ago
- Keywords commit added; needs-refresh removed
31025.2.diff applies cleanly against trunk again. It enables searching for "0" throughout the admin (post types, users, comments, plugins).
Besides that I also added /* translators: %s: search keywords */
comments where missing.
Also, I found a bug in WP_Plugins_List_Table::_search_callback
where it tries to search in array values instead of strings, throwing some warnings. I think that has to do with the recent addition of update information from the API to the plugin data (see #35301).
The
Search results for “%s”
message never appears on any admin screen when searching for "0".The attached patch changes this, as well as adds the ability to search for "0" to WP_Query.