someone added 'safety' checking to check_selected - that it needs to have matching data types so

check_selected( $t_filter['custom_fields'][$p_field_id], $t_item ); data types should match

 $t_filter['custom_fields'][$p_field_id] is an INT

Therefore $t_item should be an int

META_FILTER_ANY is an INT (although i'm not sure if it might also be a string in the soap api?)

and we compare this int to the result of utf8_strtolower($t_item) - given the !== ,  the result of that is always going to be true as (string)0 !== (int)0 is always true, so this code doesn't seem to make much sense ? ;).





On Thu, Apr 24, 2014 at 9:25 PM, P Richards <paul@mantisforge.org> wrote:

 

I’m confused…

 

Given that “check_selected” needs to have matching data types, and we do a:

 

(strtolower($item) != 0)

 

I’ve fixed a few other issues with check_selected (which may or may not be caused by db layer 2), but I don’t actually understand what we are doing here…

 

  C:\mantisforge\github\mantisbt\core\constant_inc.php (1 hit)

                Line 438: define( 'META_FILTER_ANY', 0 );

 

if(( utf8_strtolower( $t_item ) !== META_FILTER_ANY ) && ( utf8_strtolower( $t_item ) !== META_FILTER_NONE ) ) {

echo '<option value="' . string_attribute( $t_item ) . '"';

                                if( isset( $t_filter['custom_fields'][$p_field_id] ) ) {

                                                check_selected( $t_filter['custom_fields'][$p_field_id], $t_item );

 

 

  C:\mantisforge\github\mantisbt\api\soap\mc_issue_api.php (2 hits)

                Line 470:              $t_any = defined( 'META_FILTER_ANY' ) ? META_FILTER_ANY : 'any';

                Line 470:              $t_any = defined( 'META_FILTER_ANY' ) ? META_FILTER_ANY : 'any';