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

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 26 20:52:47 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.2   
Component:  Administration     |      Version:  2.8     
 Severity:  normal             |   Resolution:          
 Keywords:  has-patch commit   |  
-------------------------------+--------------------------------------------

Comment(by westi):

 Replying to [comment:14 Denis-de-Bernardy]:
 > @westi. As highlighted in my comment above, the issue is this:
 >
 > {{{
 > <p>Your Preference</p>
 > <?php $var = 0; ?>
 > <select>
 > <option value="" <?php checked($var, ''); ?>>Site Default</option>
 > <option value="1" <?php checked($var, 1); ?>>Yes</option>
 > <option value="0" <?php checked($var, 0); ?>>No</option>
 > </select>
 > }}}
 >
 > The change affect nothing in the WP code. But it's still a bug.

 Thanks.

 This isn't a new bug just an existing one and I would have thought you
 should have just used a real value for all three of the choices.

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


More information about the wp-trac mailing list