Menu

#337 error when query bugs

v1.0
open
nobody
None
5
2005-10-12
2005-10-12
Alex Flint
No

I got "a database error has occurred" message when
trying to query bugs. I'm not sure the specific
circumstances that lead to this but I managed to find
the solution. The following lines in query.php:139:

if (!empty($description)) {
$bugs_with_comment = array(0);
foreach ($db->getAll('SELECT bug_id FROM
'.TBL_COMMENT.' WHERE comment_text LIKE
\'%'.$description.'%\'') as $row) {
$bugs_with_comment[] = $row['bug_id'];
}
}

Should be changed to:

$bugs_with_comment = array(0);
if (!empty($description)) {
foreach ($db->getAll('SELECT bug_id FROM
'.TBL_COMMENT.' WHERE comment_text LIKE
\'%'.$description.'%\'') as $row) {
$bugs_with_comment[] = $row['bug_id'];
}
}

To ensure that the $bugs_with_comment array is always a
non-zero size. If not, invalid sql will be generated.

Discussion


Log in to post a comment.