Mantis Bug 1.0.7

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
rlee0001
Posts: 1
Joined: 03 May 2007, 15:43

Mantis Bug 1.0.7

Post by rlee0001 »

There is a bug in the code for the 1.0.7 release in the file core/history_api.php, function history_get_events(), line 73:

Code: Select all

     66         function history_get_events( $p_bug_id ) {
     67                 $t_mantis_bug_history_table     = config_get( 'mantis_bug_history_table' );
     68                 $t_mantis_user_table            = config_get( 'mantis_user_table' );
     69
     70                 $c_bug_id = db_prepare_int( $p_bug_id );
     71
     72                 $query = "SELECT b.*, u.username
     73                                 FROM $t_bug_history_table b
     74                                 LEFT JOIN $t_mantis_user_table u
     75                                 ON b.user_id=u.id
     76                                 WHERE bug_id='$c_bug_id'
     77                                 ORDER BY date_modified DESC";
     78                 $result = db_query( $query );
     79         }
As you can see, the config value is being loaded into the variable $t_mantis_bug_history_table, but then the variable $t_bug_history_table is being used in the SQL query. The result is an error message being displayed:

Code: Select all

APPLICATION ERROR #401

Database query failed. Error received from database was #1146: Table 'mantis_107.b' doesn't exist for the query: SELECT b.*, u.username
FROM b
LEFT JOIN mantis_user_table u
ON b.user_id=u.id
WHERE bug_id='2'
ORDER BY date_modified DESC

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
Changing line 73 fixes this.

-Robert[/code]
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Thanks a lot for reporting this. Would it be possible to report it in the bug tracker so we don't lose track of it.

http://www.mantisbt.org/bugs/
Migrate your MantisBT to the MantisHub Cloud
atomoid
Posts: 108
Joined: 18 Aug 2005, 00:46
Location: santa cruz, ca

Post by atomoid »

I don't and havent had any reports of this type of error occurring; The history function works fine for me in my installation. Perhaps there are certain steps necessary to encounter the error such as maybe having an older version of PHP or MySQL ?

Anyway, i put the change in since it makes sense to reference a table name that actually exists, and it works as well as it did before.

My config:
Mantis: 1.0.7
MySQL: 5.0.27
PHP: 5.1.6

This bug has not been added to Mantis' Mantis bugtracker yet.
Post Reply