View Issue Details

IDProjectCategoryView StatusLast Update
0010775mantisbtapi soappublic2009-10-07 14:19
Reporterrombert Assigned Tojreese  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0rc1 
Target Version1.2.0rc2Fixed in Version1.2.0rc2 
Summary0010775: [regression] Unable to update issue using SOAP API
Description

I'm getting a server error when updating an issue using the SOAP API. The error log shows:

<pre>[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</pre>

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

<pre>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</pre>

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
0001-Update-BugData-to-allow-creation-of-issue-from-the-S.patch (1,346 bytes)   
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

Activities

giallu

giallu

2009-07-29 04:46

reporter   ~0022593

kudos to git, shame on paulr...

rombert

rombert

2009-08-05 12:46

reporter   ~0022667

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

<pre>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()</pre>

giallu

giallu

2009-08-21 05:26

reporter   ~0022778

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 = '';
rombert

rombert

2009-08-21 06:53

reporter   ~0022785

@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:

<pre> # 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 );</pre>

rombert

rombert

2009-08-21 07:00

reporter   ~0022788

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:

<pre>Undefined variable: c_handler_id</pre>

I'm prepping a patch which works for me.

rombert

rombert

2009-08-21 07:07

reporter   ~0022789

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.

ericq

ericq

2009-08-23 15:11

reporter   ~0022800

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)

rombert

rombert

2009-08-27 17:04

reporter   ~0022822

@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?

tinjaw

tinjaw

2009-09-23 16:44

reporter   ~0023026

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.

rombert

rombert

2009-10-05 11:17

reporter   ~0023059

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

jreese

jreese

2009-10-06 08:51

reporter   ~0023081

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

tinjaw

tinjaw

2009-10-07 11:32

reporter   ~0023093

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

Related Changesets

MantisBT: master-1.2.x 03130d37

2009-10-05 02:20

vboctor


Details Diff
Fixes for SOAP API

1. mc_issue_add was broken since profile id wasn't set.
2. mc_issue_update was broken since it was still using bug_update() which doesn't exist anymore.
3. mc_issue_add was not adding the notes since it was used $v_notes which is undefined.
Affected Issues
0010775, 0010955
mod - api/soap/mc_issue_api.php Diff File