More than two <options>s are selected #26

Closed
scribu opened this Issue Feb 20, 2013 · 1 comment

Comments

Projects
None yet
1 participant
Owner

scribu commented Feb 20, 2013

Minimal code to reproduce:

echo scbForms::input( array(
    'name' => 'whatever',
    'type' => 'select',
    'choices' => array(
        '1/2',
        '1',
        '1 1/3',
    ),
    'selected' => '1 1/3'
) );

Result:

<label><select name="whatever">
<option value="1/2">1/2</option>
<option value="1" selected="selected">1</option>
<option value="1 1/3" selected="selected">1 1/3</option>
</select></label>

A user reported this bug against P2P:

http://wordpress.org/support/topic/issue-with-selects-on-the-post-editor

Owner

scribu commented Feb 20, 2013

Somehow, '1' gets casted to an integer, and in PHP, 1 == '1 1/3' is true, because why not?

scribu added a commit to scribu/wp-scb-framework-example that referenced this issue Feb 20, 2013

@scribu scribu closed this in 5113202 Feb 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment