[wp-trac] [WordPress Trac] #22251: Helper function to simplify checking for constants

WordPress Trac noreply at wordpress.org
Mon Oct 22 02:04:22 UTC 2012


#22251: Helper function to simplify checking for constants
-------------------------+------------------------------
 Reporter:  evansolomon  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by evansolomon):

 Replying to [comment:3 nacin]:
 > This patch conflates not defining a constant with defining it as
 something that evaluates to false. In core, we make that assumption often,
 but in a generic function, we may not be able to, which means we might be
 in a situation where we need multiple functions just to be able to test
 everything.

 It definitely assumes that the distinction is not important.  I agree
 multiple functions would probably make more sense than just one.

 > We've reduces the use of the defined && constant pattern a few times
 before, notably with WP_DEBUG, which is automatically defined as false if
 it is not defined before the bootstrap begins to load.

 It's been increasing for a while.  The WP_DEBUG change seems to have been
 in 2.9 (r12207), which also had the biggest jump in this pattern.
 Obviously in that time, lots of new code and features have been added too,
 so it may well have increased slower than it could have.

 {{{
 2.8 12
 2.9 28
 3.0 39
 3.1 40
 3.2 41
 3.3 43
 3.4 52
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22251#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list