View Issue Details

IDProjectCategoryView StatusLast Update
0021404mantisbtfilterspublic2018-05-13 16:53
Reporterraedor Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0 
Fixed in Version2.13.0 
Summary0021404: System Error on changing filters
Description

I updated my mantis installation succesfully to 1.3.0 (at least the check script ran through without problems).

But now, evyer time I am on the "View issues" page and trying to change the filters, I get:

SYSTEM ERROR
'Argument 1 passed to filter_ensure_valid_filter() must be of the type array, null given, called in .../core/filter_api.php on line 859 and defined' in '.../core/filter_api.php' line 482

Steps To Reproduce
  1. Go on "View issues"
  2. Changed something in the filters
  3. Press "Apply Filter"
TagsNo tags attached.

Relationships

related to 0021376 closeddregad Error in upgrade process 1.2.17 --> 1.3.0 
has duplicate 0022051 closedatrol update matis but getting system error error while applying filter or switching to project 
related to 0024390 closeddregad System Error on changing filters 

Activities

atrol

atrol

2016-07-21 11:31

developer   ~0053680

Last edited: 2017-03-29 06:20

if( isset( $t_setting_arr[1] ) ) {
        $t_filter_array = json_decode( $t_setting_arr[1], true );
    } else {
        return false;
    }
    if( $t_filter_array['_version'] != FILTER_VERSION ) {
        # if the version is not new enough, update it using defaults
        return filter_ensure_valid_filter( $t_filter_array );
    }

Seems that json_decode fails (delivers NULL) and filter_ensure_valid_filter is called with it.
Maybe we should silently return false in this case

A bit strange, as I would have expected that the upgrade fails if filter can't be converted to JSON.

EDIT (dregad): fix markdown

raedor

raedor

2016-07-22 03:32

reporter   ~0053688

Does that mean that there are probably other things broken in my installation? What could be a reason for the filter conversion to fail?

raedor

raedor

2016-07-25 05:28

reporter   ~0053705

The problem is I can't use the filters at all at the moment. Is there any workaround to get them back working?

Vgeorge

Vgeorge

2016-11-09 09:04

reporter   ~0054486

Last edited: 2017-03-29 06:21

Hello there,

I am facing the same problem with mantis 1.3.3 after I have upgraded from 1.2.12. The problem is actually that $t_setting_arr[1] is either a json string which json_decode can handle perfectly or a serialized php object which will result json_decode to return a JSON_ERROR_SYNTAX error. In this situation $t_filter_array will be a null object and filter_ensure_valid_filter function will fail.

The workaround that I have is checking if the $t_filter_array is null after the json decoding and if it is just unserialize the object.

if( isset( $t_setting_arr[1] ) ) {
                        $t_filter_array = json_decode( $t_setting_arr[1], true );
                        if ( is_null ($t_filter_array)){
                                $t_filter_array = unserialize($t_setting_arr[1]);
                        }
} else {

                return false;
}

Is there an explanation for this behavior? Is that a bug that is not present in clean installations? Any information will be really appreciated!

EDIT (dregad): fix markdown

hugohg34

hugohg34

2016-11-21 06:51

reporter   ~0054557

Hello,

I have same problem.
I think the problem it's a cookies of domain, I solve delete browser cookies

Vgeorge

Vgeorge

2016-11-25 04:44

reporter   ~0054586

I could't solve it with the browser cookies cleaned. I have read about this solution many times, that's strange!

cbearden

cbearden

2016-11-29 13:04

reporter   ~0054633

Some of my staff had this same issue with using Chrome.
They switched to IE or firefox and the problem seemed to go away.
Maybe this will help someone out.

ddschmid2

ddschmid2

2016-12-20 01:31

reporter   ~0054802

I have the same issue here. It appears when switching Projects or when applying filters. It appears on Chrome and IE !

cbearden

cbearden

2016-12-20 08:36

reporter   ~0054804

some of my staff figured out that if you delete your cookies, it will temp solve this problem. But it also will come back later on until you delete out cookies again.

newbe

newbe

2017-01-05 02:22

reporter   ~0054926

I upgraded from 1.2.19 to 2.0.0 - the faulty behavior in 2.0.0 is the same as described above.

ddschmid2

ddschmid2

2017-01-17 03:01

reporter   ~0055175

I updated to mantis 2 and i still have the issue. Is there a solution available already?
Clearing Cookies did help only temporarely.

SYSTEM ERROR
'Argument 1 passed to filter_ensure_valid_filter() must be of the type array, null given, called in /srv/www/htdocs/content/mantisbt-2.0.0/core/user_api.php on line 1408 and defined' in '/srv/www/htdocs/content/mantisbt-2.0.0/core/filter_api.php' line 486

raedor

raedor

2017-01-17 03:42

reporter   ~0055177

This is what helped me to solve the problem, for project I went on query_view_page.php once.

https://mantisbt.org/forums/viewtopic.php?f=3&t=23986

RealityRipple

RealityRipple

2017-01-23 14:29

reporter   ~0055272

Last edited: 2017-03-29 06:22

Suggested change for 2.0, "core/filter_api.php", line 486:

function filter_ensure_valid_filter( array $p_filter_arr = null ) {
+ if ( null == $p_filter_arr )
+ return filter_get_default();

Since filter_ensure_valid_filter is almost always called before json_decode and json_decode can return null, this seems the appropriate global resolution.

EDIT (dregad): fix markdown

dregad

dregad

2017-03-29 06:23

developer   ~0056258

@cproensa, 0021404:0055272 seems like a good idea, what do you think ?

cproensa

cproensa

2017-08-19 13:10

developer   ~0057510

Last edited: 2018-05-02 10:26

@cproensa, 0021404:0055272 seems like a good idea, what do you think ?

That is covered in PR https://github.com/mantisbt/mantisbt/pull/1091

mretallack

mretallack

2017-09-04 03:45

reporter   ~0057603

Hi, I have also had this issue upgrading from 2.1.19 to 1.3.12.

The patch found in the following post "fixed" this issue:

https://www.mantisbt.org/forums/viewtopic.php?f=2&t=24034

Thanks

dregad

dregad

2018-05-02 12:01

developer   ~0059722

@cproensa's PR 1091 was merged on 05-Mar-2018, so I would assume that this is no longer an issue starting with MantisBT 2.13.0.