Menu

#2335 (ok 2.10) Superfluous slash in db names with underscore

fixed
1
2013-06-11
2007-01-14
No

See the screen, please.
This bug appears in versions > 2.9.0.2.

Discussion

  • Victor Volkov

    Victor Volkov - 2007-01-14

    phpMyAdmin_2.9.1.1-slash_bug

     
  • Victor Volkov

    Victor Volkov - 2007-01-19

    Logged In: YES
    user_id=1686741
    Originator: YES

    Sorry, second attempt. :)

    On "Privileges" page clicking "Edit privileges" icon (root or somebody else), then in fieldset "Database-specific privileges" from the dropdown menu selecting information\_schema (or other DB with underscore in it's name), now at the top of the page we see this big sentence "User 'root'@'localhost' - Database information\_schema : Edit Privileges".
    "information\_schema" here is a link to nowhere becase that's how it looks inside:
    <a href="db_details_structure.php?token=c6a31871e57ad469ffdc3a8c8a0d8ded&amp;db=information%5C_schema&amp;reload=1">information\_schema</a>
    information%5C_schema - is not correct.

    server_privileges.php line 1581:
    echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . urlencode($dbname) . '&amp;reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
    Cnanged to:
    echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . urlencode(str_replace('\_', '_', $dbname)) . '&amp;reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
    Now it works.

    The same problem we see further, when trying to select "Table-specific privileges" dropdown menu: "User 'root'@'localhost' - Database information\_schema - Table CHARACTER_SETS : Edit Privileges"
    "CHARACTER_SETS" link looks like:
    http://localhost/phpmyadmin/tbl_properties_structure.php?token=c6a31871e57ad469ffdc3a8c8a0d8ded&db=information%5C_schema&table=CHARACTER_SETS&reload=1
    information%5C_schema - incorrect.

    Line 1583:
    echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . urlencode($dbname) . '&amp;table=' . urlencode($tablename) . '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
    Changed to:
    echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . urlencode(str_raplace('\_', '_', $dbname) . '&amp;table=' . urlencode($tablename) . '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
    It works fine either.

    Good, but twice calling functions urlencode() and str_replace() is not very good so I think it's better to create new variable... say $url_dbname. And now lines 1581-1584:
    echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . urlencode(str_replace('\_', '_', $dbname)) . '&amp;reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
    if ( isset( $tablename ) && strlen($tablename) ) {
    echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . urlencode(str_replace('\_', '_', $dbname)) . '&amp;table=' . urlencode($tablename) . '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
    }
    Ghanged to:
    $url_dbname = urlencode(str_replace('\_', '_', $dbname));
    echo ' <i><a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;reload=1">' . htmlspecialchars($dbname) . '</a></i>' . "\n";
    if ( isset( $tablename ) && strlen($tablename) ) {
    echo ' - ' . $GLOBALS['strTable'] . ' <i><a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&amp;db=' . $url_dbname . '&amp;table=' . urlencode($tablename) . '&amp;reload=1">' . htmlspecialchars($tablename) . '</a></i>' . "\n";
    }

    Hope it's valuable.

     
  • Marc Delisle

    Marc Delisle - 2007-01-20
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2007-01-20

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged in 2.10, thanks.

     
  • Marc Delisle

    Marc Delisle - 2007-01-20
    • priority: 5 --> 1
    • summary: Superfluous slash in db names with underscore --> (ok 2.10) Superfluous slash in db names with underscore
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2007-02-28
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

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