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

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 26 12:19:07 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):

 Heh, the phpdoc there is really wrong. They look a lot better in 1.5 than
 now. Don't even need two args, one arg would work fine and will make them
 more compatible (if they only echo the string). Perhaps we need to revert
 then.

 {{{
 function checked($arg) {
   if ( $arg )
     echo ' checked="checked"';
 }
 }}}
 used like:
 {{{
 checked( get_option('blah') );
 }}}
 or
 {{{
 checked( $blah === 0 );
 }}}

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


More information about the wp-trac mailing list