View Issue Details

IDProjectCategoryView StatusLast Update
0012033mantisbtinstallationpublic2011-08-02 12:35
Reporterthefake Assigned Todhx  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.1 
Target Version1.2.3Fixed in Version1.2.3 
Summary0012033: check.php tests views if they are utf8 like tables
Description

On install or update on testing the system with <path>/admin/check.php it shows some errors if there are views in the mysql database.
e.g. "Checking Table Collation is utf8 for quater_sales_view.... BAD"

The function test_database_utf8() checks the Collation field of the "SHOW TABLE STATUS" statement for every table. This will fail on views as written on http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html
quote "For views, all the fields displayed by SHOW TABLE STATUS are NULL except that Name indicates the view name and Comment says view."

Steps To Reproduce

make an view on the database where you want to install mantis, copy the copy of mantis on the webserver and run /admin/check.php

Additional Information

A possible fix would be adding a new line to the test_database_utf8() function:

code:

function test_database_utf8() {
if ( !db_is_mysql() ) {
return;
}

// table collation/character set check
$result = db_query_bound( 'SHOW TABLE STATUS' );
while( $row = db_fetch_array( $result ) ) {
  //this line drops out views
  if($row['Comment'] != 'VIEW' && $row['Comment'] != 'view' && $row['Engine'] != null){
      print_test_row( 'Checking Table Collation is utf8 for ' . $row['Name'] . '....', substr( $row['Collation'], 0, 5 ) === 'utf8_', $row['Collation'] );
    }
}

foreach( db_get_table_list() as $t_table ) {
    if( db_table_exists( $t_table ) ) {
        $result = db_query_bound( 'SHOW FULL FIELDS FROM ' . $t_table );
        while( $row = db_fetch_array( $result ) ) {
            if ( $row['Collation'] === null ) {
                continue;
            }
            print_test_row( 'Checking Non-null Column Collation in ' . $t_table . ' is utf8 for ' . $row['Field'] . '....', substr( $row['Collation'], 0, 5 ) === 'utf8_', $row['Collation'] . ' ( ' . $row['Type'] . ')' );
        }
    }
}

}

TagsNo tags attached.

Activities

dhx

dhx

2010-06-11 07:56

reporter   ~0025807

Thanks for the descriptive bug report, I've targeted it for the 1.2.2 release.

dhx

dhx

2010-08-12 09:45

reporter   ~0026297

Should be fixed now, thanks for the help!

Related Changesets

MantisBT: master a6e6fb6d

2010-08-12 09:29

dhx


Details Diff
Fix 0012033: admin/check utility treats MySQL views like tables

The function test_database_utf8() checks the Collation field of the
"SHOW TABLE STATUS" statement for every table. This will fail on views
as written on
http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html quote "For
views, all the fields displayed by SHOW TABLE STATUS are NULL except
that Name indicates the view name and Comment says view."
Affected Issues
0012033
mod - admin/check/check_database_inc.php Diff File

MantisBT: master-1.2.x 18e38217

2010-08-12 09:29

dhx


Details Diff
Fix 0012033: admin/check utility treats MySQL views like tables

The function test_database_utf8() checks the Collation field of the
"SHOW TABLE STATUS" statement for every table. This will fail on views
as written on
http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html quote "For
views, all the fields displayed by SHOW TABLE STATUS are NULL except
that Name indicates the view name and Comment says view."
Affected Issues
0012033
mod - admin/check.php Diff File