[wp-trac] [WordPress Trac] #25668: selected, checked functions

WordPress Trac noreply at wordpress.org
Wed Oct 23 19:35:43 UTC 2013


#25668: selected, checked functions
-------------------------------------+------------------------------
 Reporter:  ciapci                   |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  reporter-feedback close  |
-------------------------------------+------------------------------

Comment (by ciapci):

 Replying to [comment:8 toscho]:
 > Replying to [comment:4 markoheijnen]:
 > > I guess it would be nice to not return the value on echo but it isn't
 a big issue.
 >
 > Why? I don’t see a bug or even a problem here. If you need the return
 value as a string, you can get it. And if you want to print it out, that
 works too.
 >
 > We don’t even know if a change would break existing code. Let’s say
 someone is using the current behavior to reuse the return value:
 >
 >
 > {{{
 > $check = checked( $checked, $current, true );
 > // create the next form field then:
 > echo $check;
 > }}}
 >
 > Not very likely, but possible. The current state works, we shouldn’t
 change it without a real benefit.


 Ithe checked function is using the __checked_selected_helper function and
 in it, the $echo variable is under a if. Basically, if it's set to true,
 it echoes the string as it should, but if it is not set, it still echoes.
 $echo does not have a default value.
 If using that code you mentionedm you should get printed checked='checked'
 twice. That is not normal.

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


More information about the wp-trac mailing list