View Issue Details

IDProjectCategoryView StatusLast Update
0014343mantisbtapi soappublic2014-09-23 18:05
Reporterjmoloney Assigned Torombert  
PriorityurgentSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.10 
Target Version1.2.11Fixed in Version1.2.11 
Summary0014343: Undefined property: BugnoteData::$bugnote_text_id
Description

When I try to update an Issue with the Soap API with 1.2.10 I get the following error.

org.mantisbt.connect.MCException: Error Type: SYSTEM NOTICE,
Error Description:
Undefined property: BugnoteData::$bugnote_text_id,
Stack Trace:
bugnote_api.php L285 bugnote_get_field(<integer>62, <string>'bugnote_text_id')
bugnote_api.php L508 bugnote_get_text(<integer>62)
mc_issue_api.php L865 bugnote_set_text(<integer>62, <string>'Hi Raphaela,

also ich bin mir nicht sicher wo du eine "1" gesehn hast. )
UnknownFile L? mc_issue_update(<string>'developer', <string>'root', <integer>46, <Array> { ['id'] => 46, ['view_state'] => <Array>
{ ['id'] => 10, ['name'] => NULL }, ['last_updated'] => '2012-06-03T10:15:50.000Z', ['project'] => <Array> { ['id'] => 1,
['name'] => 'Mantis Spira Sync' }, ['category'] => 'Bug', ['priority'] => <Array> { ['id'] => 40, ['name'] => 'high' },
['severity'] => <Array> { ['id'] => 60, ['name'] => 'major' }, ['status'] => <Array> { ['id'] => 20, ['name'] => 'feedback' },
['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer', ['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' },
['summary'] => 'This is the Summary', ['version'] => NULL, ['build'] => NULL, ['platform'] => NULL, ['os'] => NULL, ['os_build'] => NULL,
['reproducibility'] => <Array> { ['id'] => 70, ['name'] => 'have not tried' }, ['date_submitted'] => '2011-10-21T17:32:44.000Z',
['sponsorship_total'] => 0, ['handler'] => <Array> { ['id'] => 4, ['name'] => 'developer', ['real_name'] => 'The Developer',
['email'] => 'dev@gmx.de' }, ['projection'] => <Array> { ['id'] => 10, ['name'] => 'none' }, ['eta'] => <Array> { ['id'] => 10,
['name'] => 'none' }, ['resolution'] => <Array> { ['id'] => 30, ['name'] => 'reopened' }, ['fixed_in_version'] => NULL,
['description'] => 'This is description',
['steps_to_reproduce'] => NULL, ['additional_information'] => NULL, ['attachments'] => <Array> { }, ['relationships'] => NULL,
['notes'] => <Array> { [0] => <Array> { ['id'] => 61, ['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer',
['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' },
['text'] => 'This is text', ['view_state'] => <Array> { ['id'] => 10,
['name'] => NULL }, ['date_submitted'] => '2011-10-21T17:32:45.000Z', ['last_modified'] => '2012-06-03T10:16:10.000Z', ['time_tracking'] => NULL,
['note_attr'] => NULL }, [1] => <Array> { ['id'] => 62, ['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer',
['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' },
'text'] => 'this text', ['view_state'] => <Array> { ['id'] => 10, ['name'] => NULL },
['date_submitted'] => '2011-10-21T17:32:45.000Z', ['last_modified'] => '2011-11-03T19:21:07.000Z', ['time_tracking'] => NULL, ['note_attr'] => NULL },
[2] => <Array> { ['id'] => 63, ['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer', ['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' },
['text'] => 'this is text', ['view_state'] => <Array> { ['id'] => 10,
['name'] => NULL }, ['date_submitted'] => '2011-10-21T17:32:45.000Z', ['last_modified'] => '2011-11-03T19:21:07.000Z', ['time_tracking'] => NULL, ['note_attr'] => NULL },
[3] => <Array> { ['id'] => 64, ['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer', ['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' },
['text'] => 'this is text', ['view_state'] => <Array> { ['id'] => 10, ['name'] => NULL }, ['date_submitted'] => '2011-10-21T17:32:45.000Z',
['last_modified'] => '2011-11-03T19:21:07.000Z', ['time_tracking'] => NULL, ['note_attr'] => NULL }, [4] => <Array> { ['id'] => 110,
['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer', ['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' }, ['text'] => 'reopened on MAntis',
['view_state'] => <Array> { ['id'] => 10, ['name'] => NULL }, ['date_submitted'] => '2012-06-03T10:08:05.000Z', ['last_modified'] => '2012-06-03T10:08:05.000Z',
['time_tracking'] => NULL, ['note_attr'] => NULL }, [5] => <Array> { ['id'] => 111, ['reporter'] => <Array> { ['id'] => 4, ['name'] => 'developer',
['real_name'] => 'The Developer', ['email'] => 'dev@gmx.de' },
:
:
:

Additional Information

This is important because we use the SOAP API to sync our errors from our internal bug tracking system with our partner who uses Mantis. We cannot update issues e.g. on Reopen

TagsNo tags attached.

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0014566 closedatrol Error messages, when updating issue with notes and monitorers 

Activities

atrol

atrol

2012-06-03 07:16

developer   ~0031986

Do you use 1.2.10 or a nightly build or latest version from github?

jmoloney

jmoloney

2012-06-03 07:29

reporter   ~0031987

We use v1.2.10
Should stress that it was ok with v1.2.8 and the API seems to have broken with v1.2.10

atrol

atrol

2012-06-03 07:38

developer   ~0031988

Are you able to reproduce the issue using http://mantisbt.mobi ? (Web interface which uses the SOAP API to connect to MantisBT)

atrol

atrol

2012-06-03 07:38

developer   ~0031989

Reminder sent to: rombert

any idea?

atrol

atrol

2012-06-03 10:30

developer   ~0031991

Last edited: 2012-06-03 10:34

There is probably a bug in bugnote_api since long time.

The class BugnoteData does not contain a field 'bugnote_text_id' but this is requested in
function bugnote_get_text which calls bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' )

There is no problem if the bugnote cache is empty.
Function bugnote_get_field will deliver the field by fetching database column bugnote_text_id of bugnote_table.

The problem will occur if bugnote cache has been filled before by function bugnote_get_all_bugnotes.

As a workaround you can comment out the lines 307-309 of function bugnote_get_field in file bugnote_api.php

if( isset( $g_cache_bugnote[(int)$p_bugnote_id] ) ) {

return $g_cache_bugnote[(int)$p_bugnote_id]->$p_field_name;

}

@jmoloney, does this fix your issue?

jmoloney

jmoloney

2012-06-03 14:06

reporter   ~0031994

Yes, this is solved my problem.
@atrol, I am well impressed.

Thanks a lot

rombert

rombert

2012-06-05 01:57

reporter   ~0032009

Joe, can you provide a few steps to reproduce this problem? I'd like to supply a fix.

atrol

atrol

2012-06-05 02:29

developer   ~0032011

rombert, I am wondering that it took so long time that the bug appears.
Seems that this field of the cache is never used in our internal workflows.

I am not sure what is the best performant and clean solution.

The quick solution without any side effects is to change function bugnote_get_field:
Just don't use the cache but select from database if $p_field_name == 'bugnote_text_id'

Another more performant approach is to cache not only the bugnote text but also the bugnote_text_id.
Adding var $bugnote_text_id to class BugnoteData should be enough for this. (I didn't try)

dregad

dregad

2012-06-05 03:38

developer   ~0032012

Last edited: 2012-06-05 03:39

Seems that this field of the cache is never used in our internal workflows.

Which kind of make sense, because bugnotes are never displayed individually (always as a full list e.g. in the bug view page).

Another more performant approach is to cache not only the bugnote text but also the bugnote_text_id.
Adding var $bugnote_text_id to class BugnoteData should be enough for this. (I didn't try)

I think this is the cleanest and easiest solution, it also would be quick to implement (just 2-3 lines of code). I also believe this is how BugnoteData should have been implemented in the first place.

Maybe a slightly better option would be to cache the whole bugnote whenever any of the fields is queried, using an approach similar to what is done for BugData class.

As with any caching solution however, there is a tradeoff between memory consumption and query performance, so to determine if it's worth the effort it's important to know how frequently bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' ) gets called, and if it is repeatedly for the same bugnotes. If not, then it's probably not worth the effort to enforce use of the cache.

dregad

dregad

2012-06-05 03:43

developer   ~0032013

That should do the trick I think (not tested)


diff --git a/core/bugnote_api.php b/core/bugnote_api.php
index 850465d..3d5a9ad 100644
--- a/core/bugnote_api.php
+++ b/core/bugnote_api.php
@@ -48,6 +48,7 @@ require_once( 'bug_api.php' );
class BugnoteData {
var $id;
var $bug_id;

  • var $bugnote_text_id;
    var $reporter_id;
    var $note;
    var $view_state;
    @@ -438,6 +439,7 @@ function bugnote_get_all_bugnotes( $p_bug_id ) {

        $t_bugnote->id = $row['id'];
        $t_bugnote->bug_id = $row['bug_id'];
  • $t_bugnote->bugnote_text_id = $row['bugnote_text_id'];
    $t_bugnote->note = $row['note'];
    $t_bugnote->view_state = $row['view_state'];
    $t_bugnote->reporter_id = $row['reporter_id'];
jmoloney

jmoloney

2012-06-05 13:08

reporter   ~0032024

Hi,

I just tried out the patch as suggested by dregad and it worked ok for me.
Note:
I removed the original commenting as suggested by atrol in comment (0031991) beforehand. :-)

Cheers and keep up the good work,
Joe

rombert

rombert

2012-06-05 15:13

reporter   ~0032025

Based on the discussion I've implemented the fix Damien has suggested.

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036271

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master b6801844

2012-06-05 07:46

rombert


Details Diff
Fix 0014343: Undefined property: BugnoteData::$bugnote_text_id

The implementation is the one proposed by dregad
Affected Issues
0014343
mod - core/bugnote_api.php Diff File

MantisBT: master-1.2.x 1d75494a

2012-06-05 07:46

rombert


Details Diff
Fix 0014343: Undefined property: BugnoteData::$bugnote_text_id

The implementation is the one proposed by dregad
Affected Issues
0014343
mod - core/bugnote_api.php Diff File