[wp-trac] [WordPress Trac] #31723: is_page( false ) === true ?

WordPress Trac noreply at wordpress.org
Sun Mar 22 11:13:43 UTC 2015


#31723: is_page( false ) === true ?
--------------------------+------------------------------
 Reporter:  Compute       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by jipmoors):

 No it's quite logical; null means that it will respect the
 `$this->is_page` value.
 The `is_null` check will only be ran when `$this->is_page` is not `false`.

 It would be more readable if it would say return `(bool) $this->is_page`
 but that is basically what it does without the use of the variable.

 If we don't have some custom object, list or ID to check against, the
 global query is used which already determined if it is a page.

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


More information about the wp-trac mailing list