2014-12-19 03:38 EST

View Issue Details Jump to Notes ] Wiki ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0010775mantisbtapi soappublic2009-10-07 14:19
Reporterrombert 
Assigned Tojreese 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Product Version1.2.0rc1 
Target Version1.2.0rc2Fixed in Version1.2.0rc2 
Summary0010775: [regression] Unable to update issue using SOAP API
DescriptionI'm getting a server error when updating an issue using the SOAP API. The error log shows:

[Wed Jul 29 10:05:44 2009] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function 
bug_update() in /home/robert/public_html/mantis/mantisbt-1.2.0rc1/api/soap/mc_issue_api.php on line 691


and a git bisect between 1.2.0a3 and 1.2.0rc1 has brought up

commit 97b67e4bbb2f2df5f6fb24eea5b4bb37e1c28acd
Author: Paul Richards <paul@mantisforge.org>
Date:   Thu Jun 11 21:58:02 2009 +0100

    Changes to bug object

:040000 040000 afa657d05e97d7325b7007a33df7338830d547d3 9aab46648148fde920b648dac694992765a85f59 M      
api
:100644 100644 bb5cac05bac78a514542b078ca61a2660bb15713 2c835881af84c12703e44025e3654a79d7b900c3 M      
bug_relationship_graph.php
:100644 100644 de92a398736b5ad777836089bd08edf659aa32a8 7fc4ecd16471ec7e4a607abce61fb15f100ae2f2 M      
bug_relationship_graph_img.php
:100644 100644 841867ebb56eb63f0e42062e459d1e1110bd9480 c2b27edefa2c1695f853dd7cd2965584d92089de M      
bug_report.php
:100644 100644 9e1f1cbe44e498b8271fa51f108828378bbde6b1 115fb7d756bbf4dd739e1cba95242198e5691b67 M      
bug_report_advanced_page.php
:100644 100644 0cc322383c8b5048d753ce5900c0c3cadbb2f8aa d9d08691f876091379a1b96a3f898eb73dd3af71 M      
bug_report_page.php
:100644 100644 0beb6368de89c0b95d9b2623ad9d9ab5ca732b80 339365a6adea80867c53afd6cee3fba0f62a5c52 M      
bug_update.php
:100644 100644 9ed05c265eaf682b037d2cf2d5b1afff4e03e7b4 ed747c3e13b8a65fde38adf36b11b75725fb0e16 M      
bug_update_advanced_page.php
:100644 100644 b4fb7bd8cc3e691cc03697e360c1f55e633063ed d38d06d521ccbd7c0a9209858ee47a28687cd56e M      
bug_update_page.php
:100644 100644 0076199bcc0c1921a614971659be6e28d72b71a9 ba2fc058fb28b90996ca90ef1cd455cd4e2e6a47 M      
bug_view_advanced_page.php
:100644 100644 fe15a32dd8d384c27e79331f7aa74bbc1132fcfe 1e17ba5ea749861dec0d20a711f9be441f061b75 M      
bug_view_inc.php
:100644 100644 ac3196d5bcfe386f66747e3d055a4cf2b8464f8b 1ad97c2c54e54b811d5979945f95d50cbf374065 M      
bug_view_page.php
:040000 040000 0e628f47f24d795219afd696359ac1a6635c57a7 e9cdae4dc8db2230d75c5d005040701ce99484b4 M      
core
:040000 040000 a72483a4796fab8a0b79be12354f8b7c9528082e 1a2cdc52b6229efb088c378ad48946193e566f19 M      
plugins
:100644 100644 8ea7432978996a8f003a832a1698f8b2894bf10d 64793b006a56e4c05bc99bb5f453a04039c1260e M      
print_all_bug_page.php
:100644 100644 81404d9cec50b95175a53d7d3d770c7bd437c383 1c8ed5d96fb729f318f21ff75cc047e043be4eff M      
print_all_bug_page_word.php
:100644 100644 5e5bf2b4391fb5aa53ac85ebd069b8abc7007d8b 13c95bb453cc7a9742978473621c52551b551418 M      
view_all_bug_page.php
:100644 100644 576fbcdcc40fda99b3e0919ba4377785efae6b30 28a4924d243c34c1df26590907fbc39e56d01727 M      
view_all_inc.php


I have confirmed the badness of the commit by reverting and testing.

Please consider fixing this for the next 1.2 RC or release, as it's a showstopper for most consumers of the SOAP API.
Tagspatch
Attached Files
  • patch file icon 0001-Update-BugData-to-allow-creation-of-issue-from-the-S.patch (1,346 bytes) 2009-08-21 07:05 - 
    From b991a765c78d5e6c9ecbd23c2ff5e4cd726a8921 Mon Sep 17 00:00:00 2001
    From: Robert Munteanu <robert.munteanu@gmail.com>
    Date: Fri, 21 Aug 2009 14:03:21 +0300
    Subject: [PATCH] Update BugData to allow creation of issue from the SOAP API
    
    The profile_id is now initially set to 0, as indicated by giallu, and
    the history_log_event_direct calls are invoked using the object's
    fields, rather than parameters.
    ---
     core/bug_api.php |    7 ++++---
     1 files changed, 4 insertions(+), 3 deletions(-)
    
    diff --git a/core/bug_api.php b/core/bug_api.php
    index 58b3f22..a055510 100644
    --- a/core/bug_api.php
    +++ b/core/bug_api.php
    @@ -99,7 +99,7 @@ class BugData {
     
     	# omitted:
     	# var $bug_text_id
    -	protected $profile_id;
    +	protected $profile_id = 0;
     
     	# extended info
     	protected $description = '';
    @@ -360,8 +360,9 @@ class BugData {
     		history_log_event_special( $this->id, NEW_BUG );
     
     		# log changes, if any (compare happens in history_log_event_direct)
    -		history_log_event_direct( $t_bug_id, 'status', $t_original_status, $t_status );
    -		history_log_event_direct( $t_bug_id, 'handler_id', 0, $c_handler_id );
    +		history_log_event_direct( $this->id, 'status', $t_original_status, $t_status );
    +		if ( 0 != $this->handler_id )
    +			history_log_event_direct( $this->id, 'handler_id', 0, $this->handler_id );
     
     		return $this->id;
     	}
    -- 
    1.6.3.3
    
    

- Relationships
+ Relationships

-  Notes
User avatar

~0022593

giallu (developer)

kudos to git, shame on paulr...
User avatar

~0022667

rombert (developer)

It's worth mentioning that mc_issue_add does not work either. I didn't have the time to bisect it - too many other failures to skip, but the error is

com.itsolut.mantis.core.exception.MantisRemoteException: Error Type: APPLICATION ERROR 0000401,
Error Description:
Database query failed. Error received from database was #1048: Column 'profile_id' cannot be null for 
the query: INSERT INTO mantis_bug_table
                                            ( project_id,reporter_id, handler_id,duplicate_id,
                                              priority,severity, reproducibility,status,
                                              resolution,projection, category_id,date_submitted,
                                              last_updated,eta, bug_text_id,
                                              os, os_build,platform, version,build,
                                              profile_id, summary, view_state, sponsorship_total, sticky, 
fixed_in_version,
                                              target_version, due_date
                                            )
                                          VALUES
                                            ( ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?).,
Stack Trace:
database_api.php L393 trigger_error(<string>'401', <integer>256)
bug_api.php L355 db_query_bound(<string>'INSERT INTO mantis_bug_table
                                            ( project_id,reporter_id, handler_id,duplicate_id,
                                              priority,severity, reproducibility,status,
                                              resolution,projection, category_id,date_submitted,
                                              last_updated,eta, bug_text_id,
                                              os, os_build,platform, version,build,
                                              profile_id, summary, view_state, sponsorship_total, sticky, 
fixed_in_version,
                                              target_version, due_date
                                            )
                                          VALUES
                                            ( ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?,
                                              ?,?,?,?)', <Array> { [0] => 1, [1] => 1, [2] 
=> '0', [3] => 0, [4] => 10, [5] => 10, [6] => 10, [7] => 10, [8] => 10, [9] => 
10, [10]
=> 1, [11] => 1249489265, [12] => 1249489265, [13] => 10, [14] => '7', [15] => '', 
[16] => '', [17] => '', [18] => '', [19] => '', [20] => NULL, [21] => 'New sample issue', 
[22] =>
 10, [23] => 0, [24] => 0, [25] => '', [26] => '', [27] => 1 })
mc_issue_api.php L530 create()
User avatar

~0022778

giallu (developer)

Robert, for the issue_add problem can you check if the following fixes the problem?

diff --git a/core/bug_api.php b/core/bug_api.php
index 23730c3..f2d8914 100644
--- a/core/bug_api.php
+++ b/core/bug_api.php
@@ -99,7 +99,7 @@ class BugData {
 
        # omitted:
        # var $bug_text_id
- protected $profile_id;
+ protected $profile_id = 0;
 
        # extended info
        protected $description = '';
User avatar

~0022785

rombert (developer)

@giallu: thanks, that does move me forward a bit.

I now get (sorry, can't beautify it):

Error Description:
  Undefined variable: t_bug_id,
Stack Trace:
   mc_issue_api.php L530 create()
   UnknownFile L? mc_issue_add(...)

My guess is that it's BugData::create(), lines 362:364, where I see $t_bug_id referenced, but I don't see it being assigned or declared anywhere:

                # log changes, if any (compare happens in history_log_event_direct)
                history_log_event_direct( $t_bug_id, 'status', $t_original_status, $t_status );
                history_log_event_direct( $t_bug_id, 'handler_id', 0, $c_handler_id );
User avatar

~0022788

rombert (developer)

Confirmed!

Commenting out those lines makes the create call succesful.

Changing from $t_bug_id to $this->id makes the create call halt due to:

Undefined variable: c_handler_id


I'm prepping a patch which works for me.
User avatar

~0022789

rombert (developer)

Please see the attached patch.

I've verified it both using the SOAP API and the HTML interface, with both simple and advanced report pages, to check that status and handler changes are properly recorded in the history.
User avatar

~0022800

ericq (reporter)

I tried the patch.
Still got the same error in mylyn. I will try to look into this too because I'm currently forced to perform updates on the web side (not too bad since I like the web gui)
User avatar

~0022822

rombert (developer)

@ericq: the patch is only for mc_issue_add . I have not had time to look into mc_issue_update ( and probably can't since I don't know the codebase well enough ).

Does creating new issues work for you with the patch applied?
User avatar

~0023026

tinjaw (reporter)

I have already moved to 1.2.0rc1 for other reasons and am now screwed as I cannot use Mylyn-Mantis connector. This has adversely affected my day-to-day workflow. This is a high-priority bug for me.
User avatar

~0023059

rombert (developer)

This works for me now, probably fixed by 03130d37b131d4223e5049b531491955dbbd2431 .
User avatar

~0023081

jreese (reporter)

This should be fixed by Victor's commits to 1.2 and master branches.
User avatar

~0023093

tinjaw (reporter)

I just grabbed the 1.2 from version control and it appears to be working for me as well.
+  Notes

+ Related Changesets

- Issue History
Date Modified Username Field Change
2009-07-29 03:16 rombert New Issue
2009-07-29 04:46 giallu Note Added: 0022593
2009-08-05 12:46 rombert Note Added: 0022667
2009-08-21 05:26 giallu Note Added: 0022778
2009-08-21 06:53 rombert Note Added: 0022785
2009-08-21 07:00 rombert Note Added: 0022788
2009-08-21 07:05 rombert File Added: 0001-Update-BugData-to-allow-creation-of-issue-from-the-S.patch
2009-08-21 07:07 rombert Note Added: 0022789
2009-08-21 07:52 rombert Tag Attached: patch
2009-08-23 15:11 ericq Note Added: 0022800
2009-08-25 02:23 vboctor Status new => confirmed
2009-08-25 02:23 vboctor Target Version => 1.2.2
2009-08-27 17:04 rombert Note Added: 0022822
2009-09-23 16:44 tinjaw Note Added: 0023026
2009-10-05 11:17 rombert Note Added: 0023059
2009-10-06 08:48 jreese Changeset attached master-1.2.x 03130d37 =>
2009-10-06 08:51 jreese Note Added: 0023081
2009-10-06 08:51 jreese Status confirmed => resolved
2009-10-06 08:51 jreese Fixed in Version => 1.2.2
2009-10-06 08:51 jreese Resolution open => fixed
2009-10-06 08:51 jreese Assigned To => jreese
2009-10-07 11:32 tinjaw Note Added: 0023093
2009-10-07 14:19 jreese Status resolved => closed
+ Issue History