Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix data type mismatch when filtering by date

Follow-up on commit 1a417b1 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 #16516
  • Loading branch information...
commit 380b5de1f44c1c56a873992c7c2c05464944485b 1 parent e8cd4be
@dregad dregad authored
Showing with 5 additions and 5 deletions.
  1. +5 −2 core/filter_api.php
  2. +0 −3  view_all_set.php
View
7 core/filter_api.php
@@ -221,7 +221,10 @@ function filter_get_url( $p_custom_filter ) {
}
if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) ) {
- $t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_FILTER_BY_DATE, $p_custom_filter[FILTER_PROPERTY_FILTER_BY_DATE] );
+ $t_query[] = filter_encode_field_and_value(
+ FILTER_PROPERTY_FILTER_BY_DATE,
+ $p_custom_filter[FILTER_PROPERTY_FILTER_BY_DATE] ? 'on' : 'off'
+ );
# The start and end dates are only applicable if filter by date is set.
if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_START_DAY] ) ) {
@@ -3877,7 +3880,7 @@ function print_filter_do_filter_by_date( $p_hide_checkbox = false ) {
<label>
<input type="checkbox" id="use_date_filters" name="<?php
echo FILTER_PROPERTY_FILTER_BY_DATE ?>"<?php
- check_checked( $t_filter[FILTER_PROPERTY_FILTER_BY_DATE], 'on' ) ?> />
+ check_checked( gpc_string_to_bool( $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ), true ) ?> />
<?php echo lang_get( 'use_date_filters' )?>
</label>
</td>
View
3  view_all_set.php
@@ -360,9 +360,6 @@
$f_type = 1;
}
-$f_do_filter_by_date = $f_do_filter_by_date ? 'on' : 'off';
-$f_sticky_issues = $f_sticky_issues ? 'on' : 'off';
-
if ( $f_type < 0 ) {
print_header_redirect( 'view_all_bug_page.php' );
}
Please sign in to comment.
Something went wrong with that request. Please try again.