Skip to content

Commit

Permalink
Fix deletion of default category on MSSQL/Oracle
Browse files Browse the repository at this point in the history
$f_category_id is of type int, but the config table's config_id column
is defined as VARCHAR(64). This causes a type mismatch on some RDBMS:

- Oracle (ORA-00932: inconsistent data types: expected -, found CLOB)
- MSSQL

Problem resolved by casting the variable to string when passing it to
db_query().

Fixes #16384
  • Loading branch information
dregad committed Mar 27, 2016
1 parent e18a9c2 commit f44b1e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion manage_proj_cat_delete.php
Expand Up @@ -68,7 +68,7 @@
# Protect the 'default category for moves' from deletion
$t_default_category_id = config_get( 'default_category_for_moves', /* default */ null, ALL_USERS, ALL_PROJECTS );
$t_query = 'SELECT count(config_id) FROM {config} WHERE config_id = ' . db_param() . ' AND value = ' . db_param();
$t_default_cat_count = db_result( db_query( $t_query, array( 'default_category_for_moves', $f_category_id ) ) );
$t_default_cat_count = db_result( db_query( $t_query, array( 'default_category_for_moves', (string)$f_category_id ) ) );
if( $t_default_cat_count > 0 || $f_category_id == $t_default_category_id ) {
trigger_error( ERROR_CATEGORY_CANNOT_DELETE_DEFAULT, ERROR );
}
Expand Down

0 comments on commit f44b1e9

Please sign in to comment.