View Issue Details

IDProjectCategoryView StatusLast Update
0011909mantisbtupgradepublic2011-04-05 14:23
Reportersmig1o Assigned Todhx  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.1 
Target Version1.2.5Fixed in Version1.2.5 
Summary0011909: Database query failed - problems with ticket revisions
Description

I get
Database query failed. Error received from database was #-1: ERROR: invalid input syntax for integer: "" for the query: SELECT * FROM mantis_bug_revision_table WHERE id=?.

when I try to see bug with modified description.

Steps To Reproduce
  1. On version 1.1.x submit a bug.
  2. Edit the bug - change description. History should state -> Description Updated
  3. Upgrade to 1.2.x
  4. Try to see the bug.
Additional Information

I was trying to find where the problem is and found out that
history_localize_item( $p_field_name, $p_type, $p_old_value, $p_new_value...)
can be called with empty
$p_old_value
and
$p_old_value
is used as id by
bug_revision_exists( $p_revision_id ).
Both functions don't check if param is set.

TagsNo tags attached.

Relationships

has duplicate 0012513 closeddhx history_localize_item is calling bug_revision_exists with a string argument where an integer is expected 

Activities

dhaun

dhaun

2010-05-13 03:54

reporter   ~0025490

Same problem here after upgrading from 1.1.8 to 1.2.1

dhaun

dhaun

2010-05-13 04:01

reporter   ~0025491

Last edited: 2010-05-13 15:07

Quick'n'dirty fix:

function bug_revision_exists( $p_revision_id ) {
if (empty($p_revision_id)) { return false; } // <-- add this line
$t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' );

in core/bug_revision_api.php

Seems to do the trick for us. Thanks, smig1o, for tracking the problem down.

[edit: fixed stupid copy&paste error]

smig1o

smig1o

2010-05-13 05:14

reporter   ~0025492

I did same 'quickfix'. But I am waiting for official patch.

gerald2545

gerald2545

2010-05-31 12:27

reporter   ~0025634

I had the same problem, upgrading from 1.1.6 to 1.2.1
+1 for this quickfix
Thank you

paontis

paontis

2010-08-16 11:01

reporter   ~0026331

We have the same problem, after migration from 1.2.0a3 to 1.2.1:

APPLICATION ERROR 0000401
Database query failed. Error received from database was 0001146: Table 'bugtracker.mantis_bug_revision_table' doesn't exist for the query: SELECT * FROM mantis_bug_revision_table WHERE id=''.

paontis

paontis

2010-08-16 11:04

reporter   ~0026332

I reinsert the error message with a space after the # so error codes are not escaped like bug ids:

APPLICATION ERROR # 401
Database query failed. Error received from database was # 1146: [...]

paontis

paontis

2010-08-17 04:16

reporter   ~0026343

In my case, for some reason during the installation the database was not upgraded, so the mantis_bug_revision_table was not created and the dates were not migrated (i always saw the default date 1970-1-1)
I realaunched the installation from a different docroot then the batabase has benn correctly update and now it works.

franklinhaut

franklinhaut

2010-08-21 08:29

reporter   ~0026392

dhaun,

i got same problem, you path works fine. Thank you

dhaun

dhaun

2010-12-19 03:31

reporter   ~0027644

This problem still exists in Mantis 1.2.4. My above workaround "fixes" the problem for now, but could someone from the Mantis team please comment on this issue?

dhx

dhx

2010-12-19 05:47

reporter   ~0027645

I filed a bug @ 0012513 which contains a more technical reason to why this issue is a problem. The comment from this bug (which I have now resolved as a duplicate of this one) is:

Within history_api, the history_localize_item function is calling the bug_revision_exists function of bug_revision_api with the wrong argument type. It should be sending an integer, not a string.

As bug_revision_api doesn't use db_prepare_int when building queries this error will result in SQL query execution errors when an integer field in the database is compared to the supplied string (type mismatch).

This is in the patch queue now :)

dhx

dhx

2010-12-24 22:28

reporter   ~0027690

Committed.

Related Changesets

MantisBT: master 730f7298

2010-12-24 22:04

dhx


Details Diff
Fix 0011909: history_localize_item sending wrong argument type to bug_revision_exists

Within history_api, the history_localize_item function is calling the
bug_revision_exists function of bug_revision_api with the wrong argument
type. It should be sending an integer, not a string.

As bug_revision_api doesn't use db_prepare_int when building queries
this error will result in SQL query execution errors when an integer
field in the database is compared to the supplied string (type
mismatch).
Affected Issues
0011909
mod - core/history_api.php Diff File

MantisBT: master-1.2.x 68e56f26

2010-12-24 22:04

dhx


Details Diff
Fix 0011909: history_localize_item sending wrong argument type to bug_revision_exists

Within history_api, the history_localize_item function is calling the
bug_revision_exists function of bug_revision_api with the wrong argument
type. It should be sending an integer, not a string.

As bug_revision_api doesn't use db_prepare_int when building queries
this error will result in SQL query execution errors when an integer
field in the database is compared to the supplied string (type
mismatch).
Affected Issues
0011909
mod - core/history_api.php Diff File