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

WordPress Trac noreply at wordpress.org
Thu Feb 12 21:38:16 UTC 2015


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

Comment (by r-a-y):

 > Switching to strict mode for is_array() is another option. However, this
 will break backward compatibility in cases like those noted by nacin here
 https://core.trac.wordpress.org/ticket/24674#comment:1.

 It also fails this test:
 https://core.trac.wordpress.org/browser/tags/4.1/tests/phpunit/tests/canonical/pageOnFront.php?marks=51#L40

 > We can avoid the weirdness of is_array() with integer needle by casting
 the needle as a string. See 24674.2.diff​.

 I think the `(string)` casting works and fixes the other issue mentioned
 by Toby in comment:16. +1!

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


More information about the wp-trac mailing list