View Issue Details

IDProjectCategoryView StatusLast Update
0016516mantisbtfilterspublic2014-12-08 02:07
Reporterrombert Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0dev 
Target Version1.3.0-beta.1 
Summary0016516: Filters: clicking on 'Use Date Filters' leads to 'Data Type mismatch'
Description

The full error message is 'Data Type mismatch. Enable detailed error messages for further information.'

Full path: /mnt/md/robert/git/mantisbt/core/helper_api.php
Line: 191

TagsNo tags attached.

Activities

atrol

atrol

2013-10-25 13:48

developer   ~0038346

Not fixed, there is a comparison of boolean and string
core/filter_api.php 3880 - - check_checked ( <boolean>false, <string>'on' )

There is code where the setting is treated as a boolean
$f_do_filter_by_date = gpc_get_bool( FILTER_PROPERTY_FILTER_BY_DATE );
but also code where it's a string
$f_do_filter_by_date = $f_do_filter_by_date ? 'on' : 'off';

dregad

dregad

2013-10-27 02:01

developer   ~0038348

Can you explain how you triggered the error? It would ease debugging (this filter api is a bitch...).

atrol

atrol

2013-10-27 04:05

developer   ~0038349

this filter api is a bitch
I know ...

1) click "View Issues"
2) click "Use Date Filters"

get


APPLICATION ERROR 0000026
Data Type mismatch. Enable detailed error messages for further information.
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
Full path: /Applications/MAMP/htdocs/mantisbt/master/core/helper_api.php
Line: 191
Variable Value Type
p_var1 boolean
p_var2 on string
p_strict 1 boolean
Filename Line Function Args
/Applications/MAMP/htdocs/mantisbt/master/core/helper_api.php 191 - - trigger_error ( <string>'26', <integer>256 )
/Applications/MAMP/htdocs/mantisbt/master/core/helper_api.php 240 - - helper_check_variables_equal ( <boolean>false, <string>'on', <boolean>true )
/Applications/MAMP/htdocs/mantisbt/master/core/filter_api.php 3880 - - check_checked ( <boolean>false, <string>'on' )

        • print_filter_do_filter_by_date -
          /Applications/MAMP/htdocs/mantisbt/master/return_dynamic_filters.php 133 - - call_user_func ( <string>'print_filter_do_filter_by_date' )
atrol

atrol

2013-10-27 05:53

developer   ~0038352

Caused by wrong adodb version.
I followed the instructions at http://www.mantisbt.org/docs/master/en-US/Developers_Guide/html-single/#dev.contrib.clone

git clone git@github.com:mantisbt/mantisbt.git
cd mantisbt
git submodule update --init

After that you have adodb version 5.10 in master branch. (also in nightly builds of master branch)

Replacing 5.10 by 5.18 fixes the issue.

atrol

atrol

2013-10-27 10:59

developer   ~0038360

Replacing 5.10 by 5.18 fixes the issue.
I was a bit doubtful when I wrote this, as I saw no relation between the issue and adodb.

The change did not explain that line 3888 of filter_api.php should be no longe a comparison of boolean and string


check_checked( $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on' )

I tried on another platform and I still get the issue.

dregad

dregad

2013-10-27 19:41

developer   ~0038366

Take 2. Hopefully that will work better ;-)

My testing for earlier commit did not take all cases into consideration (i.e. with a reset filter)

Related Changesets

MantisBT: master 1a417b12

2013-10-22 11:55

dregad


Details Diff
Fix data type mismatch when filtering by date

This was caused by inconsistent initialization of filter, which was set
to 'on' when checkbox was checked, and FALSE when unchecked. We now set
it to 'off' when unchecked.

Use of ternary operator to simplify code.

Fixes 0016516
Affected Issues
0016516
mod - view_all_set.php Diff File

MantisBT: master 380b5de1

2013-10-27 15:24

dregad


Details Diff
Fix data type mismatch when filtering by date

Follow-up on commit 1a417b123b1dbea702c3b55ff4e83bc8b8fb5545 which did
not cover all possible cases for the error.

We now consistently store the 'filter by date' property as a boolean,
and rely on gpc_string_to_bool() to ensure any string we get (e.g. 1,
'on', 'true') is properly converted to boolean before comparing. We
therefore no longer need the ternary operator in view_all_set.php. We
use 'on'/'off' when encoding the filter only.

Fixes 0016516
Affected Issues
0016516
mod - core/filter_api.php Diff File
mod - view_all_set.php Diff File