View Issue Details

IDProjectCategoryView StatusLast Update
0011565mantisbtbugtrackerpublic2010-04-23 14:30
Reporterotilia.borreta Assigned Todhx  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0 
Target Version1.2.1Fixed in Version1.2.1 
Summary0011565: $g_enable_profiles not respected on bug report page
Description

On the bug report page, profile fields are shown even with $g_enable_profiles = OFF

TagsNo tags attached.

Relationships

has duplicate 0011593 closeddhx Disabling Profiles doesn't work 
has duplicate 0011761 closeddhx Enable Profiles setting is ignored in bug report form 

Activities

dhx

dhx

2010-02-26 08:22

reporter   ~0024541

Thanks Otila for reporting this problem. I've fixed it ready for the next release.

otilia.borreta

otilia.borreta

2010-02-27 15:25

reporter   ~0024563

@dhx: sorry, I'm not sure, but I think your fix is not 100%. Shouldn't the line 181 instead of:

$tpl_show_profiles = config_get( 'enable_profiles' );

be

$tpl_show_profiles = config_get( 'enable_profiles' ) == ON;

???

dhx

dhx

2010-02-28 07:59

reporter   ~0024566

Nah it's OK without the "== ON" check because $g_enable_profiles=ON|OFF (where ON=1 and OFF=0).

It's like saying if( boolean_variable == true ) instead of just if( boolean_variable).

atrol

atrol

2010-02-28 09:00

developer   ~0024567

Just a comment but not beeing a PHP developer:
IMHO this is not clean, because ON seems to be a member of this enum (ON, OFF, AUTO) and could be changed to 0 or 4711 if anyone wants it.
Furthermore code is better readable when checking against ON

cor3huis

cor3huis

2010-03-01 05:53

reporter   ~0024578

I agree once again with Atrol, sorry dhx ;)

dhx

dhx

2010-03-04 17:17

reporter   ~0024641

Can I ask why anyone would ever decide to do something as silly as:


#define OFF 4711
#define ON 3242
#define AUTO 9281

The convention is (even as low down as within CPUs) that 0 evaluates to false and anything not 0 evaluates to true.

The only use I see for those constants is when you are working with tri-state logic and you want to write things like:


select( $t_tristate ) {
case ON:
something();
break;
case AUTO:
if( check() ) {
something();
}
break;
default:
}

Instead of using magic numbers for ON and AUTO.

atrol

atrol

2010-03-06 10:38

developer   ~0024662

Last edited: 2010-03-06 10:38

maybe a better example which does not look so silly at first moment:
why not define OFF to -1 , AUTO to 0 and ON to 1 ?
Your source will not work any longer.

It's just confusing for me to see at one place: $value = ON;
and at another place: if ( $value == TRUE ) or if ( $value )

If I want to understand your code, I have always to keep in mind that ON is somewhere at another place defined as 1

Related Changesets

MantisBT: master-1.2.x 19b969e9

2010-02-26 08:18

dhx


Details Diff
Fix 0011565: $g_enable_profiles not respected on bug report page

On the bug report page, profile fields are shown even with
$g_enable_profiles = OFF
Affected Issues
0011565
mod - bug_report_page.php Diff File

MantisBT: master ecb7cc08

2010-02-26 08:18

dhx


Details Diff
Fix 0011565: $g_enable_profiles not respected on bug report page

On the bug report page, profile fields are shown even with
$g_enable_profiles = OFF
Affected Issues
0011565
mod - bug_report_page.php Diff File