[wp-trac] [WordPress Trac] #35902: WP_Query::is_page() can return incorrect results when post title includes a slash
WordPress Trac
noreply at wordpress.org
Tue Feb 23 02:20:31 UTC 2016
#35902: WP_Query::is_page() can return incorrect results when post title includes a
slash
--------------------------------------+---------------------------
Reporter: mikejolley | Owner: boonebgorges
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 4.5
Component: General | Version: trunk
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------------
Changes (by boonebgorges):
* status: assigned => closed
* resolution: => fixed
Comment:
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/35902#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list