View Issue Details

IDProjectCategoryView StatusLast Update
0020535mantisbtplug-inspublic2016-08-28 01:12
Reportergthomas Assigned Tocproensa  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-rc.1 
Target Version1.3.1Fixed in Version1.3.1 
Summary0020535: EVENT_BUG_VIEW_ATTACHMENT prints an extra "Array" before the plugin output.
Description

I've created a simple plugin to display the attachment's owner (attacher) - see https://github.com/tgulacsi/mantisbt-plugins-ShowAttacher

It prints the wanted user name, but prefixes it with "Array".

As I see it's 'cause event_type_output sets $t_prefix=$p_params[0], which is the attachment's row - an Array.

What should be sent to event_type_output in print_api.php?
It's a little bit strange that this same $p_param is sent to the plugin callback, too...

TagsNo tags attached.

Activities

cproensa

cproensa

2016-01-21 20:34

developer   ~0052353

This event was added by 0777a1c5f2a2ae661ae546f3d6324079fdbfc515
The problem is that event type EVENT_TYPE_OUTPUT is not prepared to pass a parameter down to the callback. And this one is actually the only one doing so.
Probably was not created with the correct event type, and as it is, seems like it has never worked as intended.

I see two ways of fixing this:
1) change the event type (and specification on how it works)
2) Enhance EVENT_TYPE_OUTPUT to be able to pass data as parameters

I think (2) may be good in the long run, but needs to be reviewed.

For a quick fix, change in "events_inc.php"
'EVENT_VIEW_BUG_ATTACHMENT' => EVENT_TYPE_DEFAULT,
and use "echo" instead of "return" in your plugin function.

gthomas

gthomas

2016-01-22 05:17

reporter   ~0052356

Thanks, this works!

cproensa

cproensa

2016-01-22 09:47

developer   ~0052357

PR: https://github.com/mantisbt/mantisbt/pull/709

Related Changesets

MantisBT: master da98b637

2016-01-22 03:37

cproensa

Committer: vboctor


Details Diff
Fix passing parameters for EVENT_TYPE_OUTPUT events

Some events of EVENT_TYPE_OUTPUT specify a parameter
to be passed to the callback function.
However the event dispatcher for that type was not
designed to receive a parameter in that way.

Modified the event function to allow for that parameter
to be passed on, thus matching documented specification
and current use in code base.

Affected events are:
EVENT_MANAGE_OVERVIEW_INFO
EVENT_VIEW_BUG_ATTACHMENT

Those events have not been working properly until now.

Fixes 0020535
Affected Issues
0020535
mod - core/event_api.php Diff File

MantisBT: master-1.3.x a409d928

2016-01-22 03:37

cproensa

Committer: vboctor


Details Diff
Fix passing parameters for EVENT_TYPE_OUTPUT events

Some events of EVENT_TYPE_OUTPUT specify a parameter
to be passed to the callback function.
However the event dispatcher for that type was not
designed to receive a parameter in that way.

Modified the event function to allow for that parameter
to be passed on, thus matching documented specification
and current use in code base.

Affected events are:
EVENT_MANAGE_OVERVIEW_INFO
EVENT_VIEW_BUG_ATTACHMENT

Those events have not been working properly until now.

Fixes 0020535
Affected Issues
0020535
mod - core/event_api.php Diff File