View Issue Details

IDProjectCategoryView StatusLast Update
0016989mantisbtotherpublic2014-03-03 14:24
ReporterDavid M Assigned Toatrol  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.15 
Target Version1.2.17Fixed in Version1.2.17 
Summary0016989: The bug_get_bugnote_count() function in the bug API always returns 0
Description

It is private function of the BugData class, which means the bug's id is assigned to the attribute "id" of the object. However, in this function the code goes like the following:
$query = "SELECT COUNT(*) FROM $t_bugnote_table WHERE bug_id =" . db_param() . " $t_restriction";
$result = db_query_bound( $query, Array( $this->bug_id ) );

The "bug_id" attribute doesn't exist (since it's "id") and thus, the query searches for "bug_id=0" always, returning 0 bugnotes found. It's not critical but the API is incorrect because of it.

Steps To Reproduce

1- Create a script using bug_api.php
2- Get an existing bug, then use it to call this method
3- Display the result. It should be 0 regardless of the number of notes the bug has.

TagsNo tags attached.

Activities

atrol

atrol

2014-02-18 14:29

developer   ~0039464

Thanks David M for reporting the issue.

Related Changesets

MantisBT: master 84dd80e9

2014-02-18 09:27

atrol


Details Diff
Fix 0016989: The bug_get_bugnote_count() function in the bug API always returns 0 Affected Issues
0016989
mod - core/bug_api.php Diff File

MantisBT: master-1.2.x 122edb61

2014-02-18 09:28

atrol


Details Diff
Fix 0016989: The bug_get_bugnote_count() function in the bug API always returns 0 Affected Issues
0016989
mod - core/bug_api.php Diff File