[wp-trac] [WordPress Trac] #24674: WP_Query::is_page() should use stricter comparison

WordPress Trac noreply at wordpress.org
Tue Feb 23 02:20:30 UTC 2016


#24674: WP_Query::is_page() should use stricter comparison
--------------------------+---------------------------
 Reporter:  clifgriffin   |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  4.2
Component:  Query         |     Version:  2.5
 Severity:  minor         |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------

Comment (by boonebgorges):

 In [changeset:"36625"]:
 {{{
 #!CommitTicketReference repository="" revision="36625"
 Query: `is_*( $int )` should not falsely match strings starting with
 "$int".

 Another chapter in the Storied Annals of Weird `in_array()` Behavior:
 `in_array( 4, array( "4-cool-dudes" ) );` resolves to `true`, such that
 `is_page( 4 )` was returning true for posts with the name `'4-cool-
 dudes'`.

 We work around this behavior by ensuring that values passed to the `is_`
 methods are cast to strings before the `in_array()` checks. ID checks
 still
 work as expected; see #24674.

 Props mikejolley, swissspidy, boonebgorges.
 Fixes #35902.
 }}}

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


More information about the wp-trac mailing list