View Issue Details

IDProjectCategoryView StatusLast Update
0011609mantisbtapi soappublic2011-08-05 02:41
Reporternerville Assigned Torombert  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionunable to reproduce 
Product Version1.2.0 
Summary0011609: API : get issues of a project crash when category is empty
Description

If an issue have no category, SOAP API raise an exception.

Steps To Reproduce

1: configure mantisbt to allow no category in your config_inc.php
2: add an issue without category
3: call mc_project_get_issues soap function

Additional Information

Here a small patch to fix this exception :

--- mc_issue_api.php.orig 2010-03-04 10:22:07.000000000 +0100
+++ mc_issue_api.php 2010-03-04 10:22:37.000000000 +0100
@@ -1111,7 +1111,9 @@
$t_issue['last_updated'] = timestamp_to_iso8601( $p_issue_data->last_updated );

            $t_issue['project'] = mci_project_as_array_by_id( $p_issue_data->project_id );
  • $t_issue['category'] = mci_get_category( $p_issue_data->category_id );
  • if ( !empty( $p_issue_data->category_id ) ) {
  • $t_issue['category'] = mci_get_category( $p_issue_data->category_id );
  • }
    $t_issue['priority'] = mci_enum_get_array_by_id( $p_issue_data->priority, 'priority', $p_lang );
    $t_issue['severity'] = mci_enum_get_array_by_id( $p_issue_data->severity, 'severity', $p_lang );
    $t_issue['status'] = mci_enum_get_array_by_id( $p_issue_data->status, 'status', $p_lang );
Tagspatch

Relationships

has duplicate 0011619 closedrombert API : get issue detail crash when category is empty 

Activities

nerville

nerville

2010-03-04 04:46

reporter   ~0024626

no category option configuration is not correctly handle in mc_issue_api.php
Small workaround to get it right :

--- trunk/www/api/soap/mc_issue_api.php 2010/03/02 13:20:08 120
+++ trunk/www/api/soap/mc_issue_api.php 2010/03/03 13:28:39 125
@@ -496,7 +496,7 @@
}

$t_category_id = translate_category_name_to_id( $p_issue['category'], $t_project_id );
  • if ( $t_category_id == 0 && !config_get( 'allow_no_category' ) ) {
  • if ( $t_category_id == 0 && config_get( 'allow_no_category' ) == OFF ) {
    if ( !isset( $p_issue['category'] ) || is_blank( $p_issue['category'] ) ) {
    return new soap_fault( 'Client', '', "Category field must be supplied." );
    } else {
rombert

rombert

2010-03-04 04:56

reporter   ~0024627

Will look into it, thanks.

nerville

nerville

2010-03-05 09:40

reporter   ~0024652

If category is empty, SOAP API raise an exception on mc_issue_get
This patch fix the problem :

--- www/api/soap/mc_issue_api.php (revision 129)
+++ www/api/soap/mc_issue_api.php (working copy)
@@ -100,7 +100,9 @@
$t_issue_data['last_updated'] = timestamp_to_iso8601(
$t_bug->last_updated );

    $t_issue_data['project'] = mci_project_as_array_by_id(

$t_bug->project_id );

  • $t_issue_data['category'] = mci_null_if_empty( category_get_name(
    $t_bug->category_id ) );
  • if( !empty( $t_bug->category_id ) ) {
  • $t_issue_data['category'] = mci_null_if_empty(
    category_get_name( $t_bug->category_id ) );
  • }
    $t_issue_data['priority'] = mci_enum_get_array_by_id( $t_bug->priority,
    'priority', $t_lang );
    $t_issue_data['severity'] = mci_enum_get_array_by_id( $t_bug->severity,
    'severity', $t_lang );
    $t_issue_data['status'] = mci_enum_get_array_by_id( $t_bug->status,
    'status', $t_lang );
yw84ever

yw84ever

2010-03-05 15:14

reporter   ~0024656

Apparently categories were required in mantisbt 1.1.8 as well but not enforced. Therefore I had a bunch of tickets using "empty" categories.

After having upgraded to mantisbt 1.2.x (following git branch at the time), several issues presented themselves related to the empty categories.

For example, an issue could be changed, notes could be added, and so on, but the ticket could not be marked as resolved. Mantisbt 1.2.x complains that there is no category.

Furthermore, I left 'categories' empty for several projects when using 1.1.8. Then with 1.2.x, an issue could not even be created without selecting a category (which was usually difficult since one did not exist although the category dropdown seemed to imply one was available (the previous blank one)).

Thus far I have worked around this by a) creating generic global categories which all (most) projects inherit, b) removing/replacing the empty categories (viewing the category table contents to find the projects containing the blank categories, viewing the properties page of those projects, adjusting the categories from there), and c) reassigning categories to the nonblank ones.

Was this just a fluke in my situation or something that the upgrade procedure/script should address?

yw84ever

yw84ever

2010-03-14 10:20

reporter   ~0024734

related to issues/fixes in 0011137 ?

rombert

rombert

2010-04-05 15:12

reporter   ~0025035

@yw84ever : please open specific bugs for your problems, as they are easier to track.

rombert

rombert

2010-04-05 15:24

reporter   ~0025036

I can't reproduce using SOAP UI , and I have also added a SOAP test to our suite to verify that this works.

Please provide additional information about reproducing this bug.

yw84ever

yw84ever

2010-04-06 15:57

reporter   ~0025043

@rombert, OK

created 0011750 from my comments in 0011609:0024656

rombert

rombert

2011-04-11 18:15

reporter   ~0028593

Please retest with the latest released version of MantisBT and reopen this bug if you still encounter this issue.

Related Changesets

MantisBT: master 9af956a3

2010-04-05 15:19

rombert


Details Diff
Verify retrieval of issues without categories

Bug 0011609: API : get issues of a project crash when category is empty reported that issues
without a category set are not retrievable using the mc_filter_get function.

A regression test is added to verify that this retrieval does indeed work.
Affected Issues
0011609
mod - tests/soap/FilterTest.php Diff File

MantisBT: master-1.2.x 68b7695f

2010-04-05 15:19

rombert


Details Diff
Verify retrieval of issues without categories

Bug 0011609: API : get issues of a project crash when category is empty reported that issues
without a category set are not retrievable using the mc_filter_get function.

A regression test is added to verify that this retrieval does indeed work.
Affected Issues
0011609
mod - tests/soap/FilterTest.php Diff File