[wp-trac] [WordPress Trac] #35820: WP_Query(array( 'p' => 0)) will return posts

WordPress Trac noreply at wordpress.org
Fri Feb 12 21:28:17 UTC 2016

#35820: WP_Query(array( 'p' => 0)) will return posts
 Reporter:  ChiefAlchemist  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Database        |    Version:  4.4.2
 Severity:  normal          |   Keywords:
  Focuses:                  |
 Long to short, I was presuming that if the $args were such that no rows
 exist then WP_Query would return nothing.

 Not so.

 If by chance, 'p' => 0, you do get results.

 Perhaps the 0 is interpreted as false? Even so, an ID == false should
 return no row, yes? Or one might argue "well, that query doesn't make
 sense. it's not really valid." again, all the more reason to return

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

More information about the wp-trac mailing list