Skip to content

Commit

Permalink
Fix data type mismatch error with custom field filter
Browse files Browse the repository at this point in the history
Disable strict type checking on check_selected() calls in
print_filter_custom_field() as there is no way to cover all possible
test cases by typecasting the parameters.

Fixes #19916
  • Loading branch information
dregad committed Aug 2, 2015
1 parent 393bab0 commit 6759ec1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/filter_api.php
Expand Up @@ -4129,13 +4129,13 @@ function print_filter_custom_field( $p_field_id ) {
} else {
echo '<select' . $g_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
echo '<option value="' . META_FILTER_ANY . '"';
check_selected( $g_filter['custom_fields'][$p_field_id], (string)META_FILTER_ANY );
check_selected( $g_filter['custom_fields'][$p_field_id], META_FILTER_ANY, false );
echo '>[' . lang_get( 'any' ) . ']</option>';

# don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank
if( !in_array( $t_accessible_custom_fields_types[$j], array( CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST ) ) ) {
echo '<option value="' . META_FILTER_NONE . '"';
check_selected( $g_filter['custom_fields'][$p_field_id], (string)META_FILTER_NONE );
check_selected( $g_filter['custom_fields'][$p_field_id], META_FILTER_NONE, false );
echo '>[' . lang_get( 'none' ) . ']</option>';
}
if( is_array( $t_accessible_custom_fields_values[$j] ) ) {
Expand All @@ -4144,7 +4144,7 @@ function print_filter_custom_field( $p_field_id ) {
if( ( strtolower( $t_item ) !== META_FILTER_ANY ) && ( strtolower( $t_item ) !== META_FILTER_NONE ) ) {
echo '<option value="' . string_attribute( $t_item ) . '"';
if( isset( $g_filter['custom_fields'][$p_field_id] ) ) {
check_selected( $g_filter['custom_fields'][$p_field_id], $t_item );
check_selected( $g_filter['custom_fields'][$p_field_id], $t_item, false );
}
echo '>' . string_attribute( string_shorten( $t_item, $t_max_length ) ) . '</option>' . "\n";
}
Expand Down

0 comments on commit 6759ec1

Please sign in to comment.