Closed
Bug 645427
Opened 14 years ago
Closed 13 years ago
Bugzilla->usage_mode( USAGE_MODE_BROWSER ) doesn't change Bugzilla->usage_mode
Categories
(Bugzilla :: Bugzilla-General, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.4
People
(Reporter: yavor.nikolov7+bugzilla, Assigned: koosha.khajeh)
References
Details
Attachments
(1 file)
625 bytes,
patch
|
LpSolit
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: 4.1.1
Bugzilla->usage_mode( Bugzilla::Constants->USAGE_MODE_BROWSER ) doesn't change Bugzilla->usage_mode to USAGE_MODE_BROWSER
Reproducible: Always
Steps to Reproduce:
print( "USAGE_MODE_BROWSER: ", Bugzilla::Constants->USAGE_MODE_BROWSER, "\n" );
print( "USAGE_MODE_CMDLINE: ", Bugzilla::Constants->USAGE_MODE_CMDLINE, "\n" );
print( "usage_mode before change: ", Bugzilla->usage_mode, "\n" );
my $res1 = Bugzilla->usage_mode( Bugzilla::Constants->USAGE_MODE_BROWSER );
print( "usage_mode during change: ", $res1, "\n" );
print( "usage_mode after change: ", Bugzilla->usage_mode, "\n" );
Actual Results:
USAGE_MODE_BROWSER: 0
USAGE_MODE_CMDLINE: 1
usage_mode before change: 1
usage_mode during change: 1
usage_mode after change: 1
Expected Results:
USAGE_MODE_BROWSER: 0
USAGE_MODE_CMDLINE: 1
usage_mode before change: 1
usage_mode during change: 0
usage_mode after change: 0
Root cause is return statement in Bugzilla::usage_mode:
return $class->request_cache->{usage_mode}
|| (i_am_cgi()? USAGE_MODE_BROWSER : USAGE_MODE_CMDLINE);
When $class->request_cache->{usage_mode} == 0 first part of the || expression is always discarded.
Reporter | ||
Comment 1•14 years ago
|
||
Looking at usage_mode code of stable older releases - issues seems to exist since 3.2
Reporter | ||
Comment 2•14 years ago
|
||
Sorry... I meant since 3.4 (not 3.2)
![]() |
||
Comment 3•14 years ago
|
||
We should probably check "exists $class->request_cache->{usage_mode}".
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → 4.1.1
Updated•14 years ago
|
Severity: normal → minor
Attachment #617193 -
Flags: review?(mkanat)
Attachment #617193 -
Flags: review?(LpSolit)
![]() |
||
Comment 6•13 years ago
|
||
Comment on attachment 617193 [details] [diff] [review]
V1
>+ if (exists($class->request_cache->{usage_mode})) {
>+ return $class->request_cache->{usage_mode};
>+ }
>+ else {
>+ return (i_am_cgi()? USAGE_MODE_BROWSER : USAGE_MODE_CMDLINE);
>+ }
Once we require Perl 5.10.1, all this code can simply be replaced by:
return $class->request_cache->{usage_mode}
// (i_am_cgi()? USAGE_MODE_BROWSER : USAGE_MODE_CMDLINE);
I will add a comment above this code so that we remember to do it in Bugzilla 4.6. r=LpSolit
Attachment #617193 -
Flags: review?(mkanat)
Attachment #617193 -
Flags: review?(LpSolit)
Attachment #617193 -
Flags: review+
![]() |
||
Comment 7•13 years ago
|
||
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla.pm
Committed revision 8213.
Assignee: general → koosha.khajeh
Status: NEW → RESOLVED
Closed: 13 years ago
Depends on: 655477
Flags: approval+
Resolution: --- → FIXED
Whiteboard: [Good Intro Bug]
Target Milestone: --- → Bugzilla 4.4
You need to log in
before you can comment on or make changes to this bug.
Description
•