Menu

#1765 Edit field: No blank option for Attributes or Extra column

Latest_Git
fixed
5
2013-06-11
2005-08-23
Brian
No

When editing a field or fields in a table, the Extra
and Attributes columns select boxes do not allow a
blank value, forcing an unwanted attribute or
auto_increment on the field, either resulting in a
query error when the table is updated or unwanted
changes made to the tables field.

I assume this bug is not always reproducable... this
bug would not fly under the radar as it severely
hinders functionality of phpMyAdmin. I do not know
specifically how to reproduce it, however I have only
had this problem on my gentoo box, first using the
ebuild for phpMyAdmin 2.6.3-pl1 and now with the latest
cvs checked out as of the date of this bug submission.

The attachment is an html dumb of the tbl_alter frame.
You can clearly see no blank options in the specifield
select tags.

Discussion

  • Brian

    Brian - 2005-08-23

    tbl_alter.php html dump

     
  • Brian

    Brian - 2005-08-23

    Logged In: YES
    user_id=1333990

    Ok, this has gotten even wierder. I did a little searching
    and found the code responsible for generating the select
    values. Here is the slight mod I made (in
    tbl_properties.inc.php)

    $content_cells[$i][$ci] = '<select name="field_extra[]"
    id="field_' . $i . '_' . ($ci - $ci_offset) . '">';

    if (!isset($row) || empty($row['Extra'])) {
    $content_cells[$i][$ci] .= '<!-- !isset($row) ||
    empty($row[Extra] -->';
    $content_cells[$i][$ci] .= "\n";
    $content_cells[$i][$ci] .= '<option
    value=""></option>' . "\n";
    $content_cells[$i][$ci] .= '<option
    value="AUTO_INCREMENT">auto_increment</option>' . "\n";
    } else {
    $content_cells[$i][$ci] .= '<!-- the else] -->';
    $content_cells[$i][$ci] .= "\n";
    $content_cells[$i][$ci] .= '<option
    value="AUTO_INCREMENT">auto_increment</option>' . "\n";
    $content_cells[$i][$ci] .= '<option
    value=""></option>' . "\n";
    }

    $content_cells[$i][$ci] .= "\n" . '</select>';
    $ci++;

    As you can see I just added in html comments to see which
    condition it took. I checked the resulting html and this is
    what I got:

    <select name="field_extra[]"
    id="field_0_8">
    <!-- !isset($row) || empty($row[Extra] -->
    <option value="AUTO_INCREMENT">auto_increment</option>
    </select>

    Clearly, according to the code there should be a blank
    option here, but there is not. I have no idea what is going on.

     
  • Brian

    Brian - 2005-08-23

    Logged In: YES
    user_id=1333990

    Ok, I fixed the problem by changing the line responsible for
    adding the blank option from

    $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";

    to

    $content_cells[$i][$ci] .= '<option value="">None</option>'
    . "\n";

    I assume the same would work for the attributes field and
    any other field where this is a problem. I'm not familiar
    enough with the code base to ever think of why this would
    occur, or why it is not always reproducable (ive had this
    problem with both php 5.0.4 and 5.1 beta 3)

     
  • Marc Delisle

    Marc Delisle - 2005-08-23

    Logged In: YES
    user_id=210714

    In tbl_properties.inc.php at line 375, please add

    echo '<pre>'; print_r($cfg['AttributeTypes']); echo '</pre>';

    and tell me the results.

    For the Extra, in the same module, around line 444, try to
    find what is happening by modifying like this:
    if (!isset($row) || empty($row['Extra'])) {
    $content_cells[$i][$ci] .= "\n";
    $content_cells[$i][$ci] .= '<option
    value=""></option>' . "\n";
    $content_cells[$i][$ci] .= '<option
    value="AUTO_INCREMENT">auto_incrementAAA</option>' . "\n";
    } else {
    $content_cells[$i][$ci] .= "\n";
    $content_cells[$i][$ci] .= '<option
    value="AUTO_INCREMENT">auto_incrementBBB</option>' . "\n";
    $content_cells[$i][$ci] .= '<option
    value=""></option>' . "\n";
    }

     
  • Marc Delisle

    Marc Delisle - 2005-08-23
    • assigned_to: nobody --> lem9
     
  • Brian

    Brian - 2005-08-24

    Logged In: YES
    user_id=1333990

    I found the problem. I have tidy built into php 5, with the
    tidy.clean_output directive set to yes in the php.ini. I
    switched this to No, and everything worked fine. I know
    tidy will at times remove erronious tags, but I see nothing
    wrong with the option tag.

     
  • Marc Delisle

    Marc Delisle - 2005-08-27
    • status: open --> closed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed --> fixed