mantisbt-plugins / VEditor

MIT License
2 stars 0 forks source link

ERROR_BUGNOTE_NOT_FOUND on changing bug state #4

Closed wencagh closed 5 months ago

wencagh commented 5 months ago

I caught the bug ERROR_BUGNOTE_NOT_FOUND with VEditor v1.1.0 and MantisBT 2.26.1 on action when state of bug(issue) is changing. Not dependet if additional message with state change was filled or not.

It seems, that this is working solution:

function bugnote_edit($p_event, $p_bug_id, $p_bugnote_id, $files = null) {
        if (plugin_config_get('conv_img_to_file', 0) === 0) {
            return;
        }
//fix start
        if (!isset($p_bugnote_id)) {
            return;
        }
//fix end
        $t_text = bugnote_get_text($p_bugnote_id);
        $this->update_img_bugnote($p_bug_id, $p_bugnote_id, $t_text);
    }
pysiek634 commented 5 months ago

Could you provide a execution stack? (or some lines from Apache error_log )

This error is strange for me, because bugnote_edit function is called by Mantis events, which always provide bugnote_id eg. event_signal( 'EVENT_BUGNOTE_ADD', array( $p_bug_id, $t_bugnote_id, array() ) ); Without bugnote_id calling this function makes no sense.

wencagh commented 5 months ago

Thank you for you response. After next investgation it seems, that root cause is another custom plugin, which is in case of bug status change signaling EVENT_BUGNOTE_ADD with null id of bugnote.