View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016340 | mantisbt | db db2 | public | 2013-08-30 09:23 | 2014-02-07 18:24 |
Reporter | judan | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.11 | ||||
Target Version | 1.2.16 | Fixed in Version | 1.2.16 | ||
Summary | 0016340: Error 401 for Manage Tags | ||||
Description | Hi i am getting an error 401 when i click on manage tags. The error further gives an sql query as the cause for the error. The sql query is: SELECT * Firstly i created a tag and after the manage_tags_page.php page refreshes the error shows up. | ||||
Steps To Reproduce |
| ||||
Tags | No tags attached. | ||||
Attached Files | manage_tags_page.php.htm (3,816 bytes)
<!-- saved from url=(0048)http://192.168.0.4/mantisbt/manage_tags_page.php --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><br><div align="center"><table class="width50" cellspacing="1"><tbody><tr><td class="form-title">APPLICATION ERROR #401</td></tr><tr><td><p class="center" style="color:red">Database query failed. Error received from database was #42601: Use of NULL is not valid. SQLCODE=-128 for the query: SELECT *<br> FROM mantis_user_table<br> WHERE id=?.</p></td></tr><tr><td><p class="center">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.</p></td></tr><tr><td> <center> <table class="width75"> <tbody><tr> <td>Full path: /www/mywebsite/htdocs/mantisbt/core/database_api.php</td> </tr> <tr> <td>Line: 405</td> </tr> <tr> <td> <table class="width100"><tbody><tr><th>Variable</th><th>Value</th><th>Type</th></tr><tr><td>p_query</td><td>SELECT * FROM mantis_user_table WHERE id=?</td><td>string</td></tr> <tr><td>p_limit</td><td>-1</td><td>integer</td></tr> <tr><td>p_offset</td><td>-1</td><td>integer</td></tr> <tr><td>g_db_log_queries</td><td></td><td>boolean</td></tr> <tr><td>g_db_param_count</td><td>11</td><td>integer</td></tr> <tr><td>t_db_type</td><td>db2</td><td>string</td></tr> <tr><td>s_check_params</td><td></td><td>boolean</td></tr> <tr><td>t_result</td><td></td><td>boolean</td></tr> <tr><td colspan="3" align="left"><br><strong>arr_parms</strong></td></tr><tr><td colspan="3"><table class="width100"><tbody><tr><th>Variable</th><th>Value</th><th>Type</th></tr><tr><td>0</td><td></td><td>NULL</td></tr> </tbody></table></td></tr><tr><td colspan="3" align="left"><br><strong>g_queries_array</strong></td></tr><tr><td colspan="3"><table class="width100"><tbody><tr><th>Variable</th><th>Value</th><th>Type</th></tr><tr><td>0</td><td>1</td><td>integer</td></tr> <tr><td>1</td><td>1</td><td>integer</td></tr> <tr><td>2</td><td>1</td><td>integer</td></tr> <tr><td>3</td><td>1</td><td>integer</td></tr> <tr><td>4</td><td>1</td><td>integer</td></tr> <tr><td>5</td><td>1</td><td>integer</td></tr> <tr><td>6</td><td>1</td><td>integer</td></tr> <tr><td>7</td><td>1</td><td>integer</td></tr> <tr><td>8</td><td>1</td><td>integer</td></tr> <tr><td>9</td><td>1</td><td>integer</td></tr> <tr><td>10</td><td>1</td><td>integer</td></tr> <tr><td>11</td><td>1</td><td>integer</td></tr> <tr><td>12</td><td>1</td><td>integer</td></tr> <tr><td>13</td><td>1</td><td>integer</td></tr> </tbody></table></td></tr></tbody></table> </td> </tr> </tbody></table> </center> </td></tr><tr><td><center><table class="width75"><tbody><tr><th>Filename</th><th>Line</th><th></th><th></th><th>Function</th><th>Args</th></tr><tr class="row-1"><td>/www/mywebsite/htdocs/mantisbt/core/database_api.php</td><td>405</td><td>-</td><td>-</td><td>trigger_error</td><td>( <string>'401', <integer>256 )</td></tr><tr class="row-2"><td>/www/mywebsite/htdocs/mantisbt/core/user_api.php</td><td>57</td><td>-</td><td>-</td><td>db_query_bound</td><td>( <string>'SELECT * FROM mantis_user_table WHERE id=?', <Array> { [0] => NULL } )</td></tr><tr class="row-1"><td>/www/mywebsite/htdocs/mantisbt/core/user_api.php</td><td>770</td><td>-</td><td>-</td><td>user_cache_row</td><td>( <NULL>NULL, <boolean>false )</td></tr><tr class="row-2"><td>/www/mywebsite/htdocs/mantisbt/manage_tags_page.php</td><td>144</td><td>-</td><td>-</td><td>user_get_name</td><td>( <NULL>NULL )</td></tr></tbody></table></center></td></tr></tbody></table></div> </body></html> | ||||
I was not able to reproduce your problem with a fresh install of the latest stable version of MantisBT (1.2.15 at the moment) and the provided instructions. I recommend that you upgrade to 1.2.15; if the problem persists after that, feel free to reopen the issue, and provide the following additional information:
|
|
By the way, the only way there could be NULL for the mentioned query in this context, is if a tag's creator is 0, which can't happen with normal MantisBT operations - was the DB tampered with ? |
|
Hi dregad. Thanks for the response. I upgraded and have the same problem. We are currently using mantisbt with db2. We currently have IBMi v7r1. I dont know if the problem occurred because of the way in which we installed mantis. We had numerous problems installing mantisbt over db2 the standard way i.e using /admin/install.php so we applied a workaround by editing the install script(see attactment 'Mantis SQL Setup.sql')to install the tables manually. Then we created the config_inc.php with the necessary credentials. Also the zero in the line 'define('ADODB_FETCH_ASSOC',0);' was changed from 2 to zero from the file adodb.inc because users could not log in without this change. So everything else works for mantis except for this manage tags problem. |
|
The tag seems to have been created properly. The insert statement has a row id of 16 and all other values. -PHP version: 5.2.17 |
|
I don't have any experience with DB2, and support for that is (very) limited, what we've got in the code has been contributed to by users like you who made it work. That said- some comments:
Can you provide additional, debugging information:
$g_show_detailed_errors = ON; WARNING - SECURITY RISK: the 'show_detailed_errors' config can cause MantisBT to display sensitive information about your system. We recommend to restrict its activation to a Test environment, only for as long as necessary. If possible, do not turn it ON globally, instead limit it for specific user(s) using the Manage Configuration page.
|
|
Hi dregad. I now think that the error is specific to db2 because i installed mantisbt on my local machine with the same settings but with mysql and it works okay. |
|
Looking at the call stack, the error occurs because Mantis is trying to retrieve the id of a user whose name is NULL. Can you look at the contents of mantis_tag_table, specifically the contents of the 'user_id' column. Are there any NULL values (maybe also check for '0's or empty strings) in there ? |
|
The tag table seems fine. The newly created tag appears to have been inserted correctly. I've uploaded 'mantis_tag_table.png' to show this. With regards to the error, as you may have noticed occurs because of the line: 'SELECT * FROM mantis_user_table WHERE id=null' from the file 'core/user_api.php' on line 57. The last line in the mantis log is: 'SELECT * When this is compared with the log on the local machine(the one using mysql instead of db2) for the same action the last line is: 'UPDATE mantis_user_table So instead of a SELECT statement it has an UPDATE statement. I was thinking that the UPDATE statement made sense because it records the date/time last visit for this user, but the SELECT statement is a bit of a question mark. |
|
You can't compare just the last statement from both logs, because in one case the whole operation went through, while in the other the process was interrupted by an error. If you look further up in your mysql log you should see the same select statement; its purpose is to retrieve and cache the user data, following a request to display the user's name, but that's not the root cause of the problem, just a consequence of it. In your case I would expect to see 'SELECT * FROM mantis_user_table WHERE id=48'. The real question is, why do we get a NULL here instead, even though the DB has 48. Please take a backup of manage_tags_page.php, then insert the following code right after line 110 (i.e. just before the '?>' tag):
Load the page, report the output here. Then you can restore the code. Also, check in your SQL log, a query beginning with 'SELECT * FROM mantis_tag_table ...' and let me know what the actual full query is as well. |
|
Hi dregad. We have found and implemented a workaround for this issue. We re-installed mantisbt but with mysql instead and linked mysql to the db2 through the ibmdb2i storage engine. So mantisbt works with db2 by replication. Thanks very much for all your replies and suggestions. ~Jailall~ |
|
Good to hear that you found a solution to your problem. Nevertheless if you can spare the time and effort, it would be nice to go to the bottom of this issue and make mantis work with db2 natively. Could you provide the info I requested earlier, and if needed execute additional troubleshooting instructions as well as perform some tests if needed? |
|
Hi, dregad. This is the output from the vardump:
EDIT (dregad): formatted |
|
Here is the select statement for mantis_tag_table: 0 => 'SELECT * FROM mantis_tag_table |
|
Thanks for the update. So it would appear that ADOdb library is returning the correct User ID (as expected). Can you try adding var_dump($t_tag_row);right after the foreach at line 136 ? (you can remove the previous var_dump). |
|
Here's the vardump: array(6) { [0]=> int(17) [1]=> int(48) [2]=> string(5) "Email" [3]=> string(11) "Banks email" [4]=> int(1378126159) [5]=> int(1378126159) } |
|
Ok i think i get it, the problem is likely due to the adodb fetch mode, the returned array is numerically indexed but mantis expects an associative array with field names as keys. I need to look into the code to make sure what the best solution is, but it shouldn't be too hard to fix in any case. I'll let you know if more testing is needed. |
|
ok. please let me know if you fixed the problem. |
|
The attached changesets should fix the issue, which was in fact a regression introduced by 0013446. The patch will probably apply cleanly on top of 1.2.15, but in case it does not, you can download a nightly build (make sure date >= 07-Sep-2013). Please test and let me know the results, reopen the issue if the problem persists. |
|
Hi i modified the three files in the changesets list: -> mod - api/soap/mc_tag_api.php But i got a error when i clicked on the manage_tags_page link: => Fatal error: Call to undefined function require_api() in /www/sitesdirectory/htdocs/mantisbt1.2.11/manage_tags_page.php on line 41 Line 41 is: -> require_once( 'core.php' ); |
|
Sounds like not only you replaced the whole files instead of just applying the patch, but you also copied the file from the 'master' branch changeset; you should take the ones from 'master-1.2.x'. |
|
ok im not sure how to 'apply' the patch. I thought i was supposed to replace the files. |
|
Get the patch from [1] and apply it as described in [2]. [1] https://github.com/mantisbt/mantisbt/commit/0d9c5e799ce58a8632678979e395025a0ebeb0ec.patch |
|
Hi dregad. Sorry for the late response. I was busy with other work. So i applied the patch to the files, but there still seems to be a bug. Note: we do have a tag entry in the tags table. Also when i click on the 'create tag' link nothing happens. I have uploaded 'no_tags.png' to show this. |
|
I did a vardump after the lines: -> # Retrieve Tags from table and i got: NULL |
|
I think i made a stupid mistake in the code, can you try replacing '$t_result' by '$t_tags' at line 111 in manage_tags_page.php |
|
I made the correction. The tags operations seems to be working fine now. |
|
MantisBT: master-1.2.x 0d9c5e79 2013-09-06 15:01 Details Diff |
Fix usage of tag_get_all for DBs not using Assoc fetch mode This is a regression caused by implementation of issue 0013446 (see commit be3dde781523d4ecf11664eff0e6ec050993e044), which used a foreach to iterate throught the ADOdb recordset returned by tag_get_all(), instead of using MantisBT's db_fetch_array() function which takes care of row association for DBs not supporting it natively. Fixes 0016340 |
Affected Issues 0013446, 0016340 |
|
mod - api/soap/mc_tag_api.php | Diff File | ||
mod - core/tag_api.php | Diff File | ||
mod - manage_tags_page.php | Diff File | ||
MantisBT: master 566b5363 2013-09-06 15:01 Details Diff |
Fix usage of tag_get_all for DBs not using Assoc fetch mode This is a regression caused by implementation of issue 0013446 (see commit be3dde781523d4ecf11664eff0e6ec050993e044), which used a foreach to iterate throught the ADOdb recordset returned by tag_get_all(), instead of using MantisBT's db_fetch_array() function which takes care of row association for DBs not supporting it natively. Fixes 0016340 |
Affected Issues 0013446, 0016340 |
|
mod - api/soap/mc_tag_api.php | Diff File | ||
mod - core/tag_api.php | Diff File | ||
mod - manage_tags_page.php | Diff File | ||
MantisBT: master-1.2.x 68937db4 2013-09-11 14:20 Details Diff |
Fix assignment to wrong variable This caused the page to always display an empty list of tags. Follow up fix on commit 0d9c5e799ce58a8632678979e395025a0ebeb0ec. Fixes 0016340 |
Affected Issues 0016340 |
|
mod - manage_tags_page.php | Diff File |