[wp-trac] [WordPress Trac] #11330: Empty search takes you to homepage instead of empty search page

WordPress Trac noreply at wordpress.org
Wed Jun 4 19:10:09 UTC 2014


#11330: Empty search takes you to homepage instead of empty search page
------------------------------+-----------------------------
 Reporter:  jacobfogg         |       Owner:  wonderboymusic
     Type:  defect (bug)      |      Status:  reopened
 Priority:  low               |   Milestone:  4.0
Component:  Query             |     Version:  2.8.5
 Severity:  minor             |  Resolution:
 Keywords:  has-patch commit  |     Focuses:
------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 This broke filters in the admin:

 1. Go to All Posts screen.
 2. Select any category in "View all categories" dropdown and click
 "Filter".
 3. You'll get "No posts found", because the URL contains an empty `s`
 parameter.
 4. If you choose a month in "All dates" dropdown instead, you'll also get
 an SQL error: [[BR]]
  WordPress database error: [You have an error in your SQL syntax; check
 the manual that corresponds to your MySQL server version for the right
 syntax to use near '0 AND develop_posts.post_type = 'post' AND
 (develop_posts.post_status = 'publish' at line 1] [[BR]]
  `SELECT SQL_CALC_FOUND_ROWS develop_posts.ID FROM develop_posts WHERE 1=1
 AND YEAR(develop_posts.post_date)=2014 AND
 MONTH(develop_posts.post_date)=06AND 0 AND develop_posts.post_type =
 'post' AND (develop_posts.post_status = 'publish' OR
 develop_posts.post_status = 'future' OR develop_posts.post_status =
 'draft' OR develop_posts.post_status = 'pending' OR
 develop_posts.post_status = 'private') ORDER BY develop_posts.post_date
 DESC LIMIT 0, 20`

 [attachment:11330.4.diff] fixes the SQL error.

 I'm not quite sure what to do with the general filter breakage. Looks like
 this fix can lead to unexpected results elsewhere, so perhaps it should be
 reverted.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/11330#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list