[wp-trac] Re: [WordPress Trac] #9862: checked/selected helper confuses '0' and ''

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 26 08:17:12 GMT 2009


#9862: checked/selected helper confuses '0' and ''
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |        Owner:  westi   
     Type:  defect (bug)       |       Status:  reopened
 Priority:  low                |    Milestone:  2.8.1   
Component:  Administration     |      Version:  2.8     
 Severity:  normal             |   Resolution:          
 Keywords:  has-patch commit   |  
-------------------------------+--------------------------------------------

Comment(by azaozz):

 The patch seems to fix some instances but may break some too and it still
 doesn't cover all possibilities.

 IMHO this is typical function bloat. Why do we need three functions to
 deal with something as simple as
 {{{
 if ( get_option('blah') ) echo ' checked="checked"';
 }}}

 They not only make the code harder to read but will need two extra
 arguments to cover all possible cases (single/double quotes and strict
 comparison). That's a total of 5 arguments!

 Don't see any benefits in using these functions, even in the simple cases
 where they work well the code is harder to read which is a big minus.

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


More information about the wp-trac mailing list