Closed Bug 645433 Opened 14 years ago Closed 13 years ago

Bugzilla->error_mode( ERROR_MODE_WEBPAGE ) doesn't change Bugzilla->error_mode

Categories

(Bugzilla :: Bugzilla-General, defect)

4.1.1
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: yavor.nikolov7+bugzilla, Assigned: koosha.khajeh)

References

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Build Identifier: 4.1.1 This is very similar to bug #645427 sub error_mode { ... return $class->request_cache->{error_mode} || (i_am_cgi() ? ERROR_MODE_WEBPAGE : ERROR_MODE_DIE); } With ERROR_MODE_WEBPAGE the above return always ignores first part of the || expression because ERROR_MODE_WEBPAGE == 0. Reproducible: Always Steps to Reproduce: From console app run Bugzilla->usage_mode( USAGE_MODE_BROWSER ) - this also attempts to change error_mode Actual Results: Bugzilla->error_mode( ERROR_MODE_WEBPAGE ) doesn't change Bugzilla->usage_mode to ERROR_MODE_WEBPAGE Expected Results: Bugzilla->error_mode( ERROR_MODE_WEBPAGE ) should change Bugzilla->usage_mode to ERROR_MODE_WEBPAGE
In Expected/Actual Results of problem description Bugzilla->usage_mode should be read as Bugzilla->error_mode.
We should check "exists $class->request_cache->{error_mode}".
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → 4.1.1
Severity: normal → minor
Whiteboard: [Good Intro Bug]
Attached patch V1Splinter Review
The return statement in the 'else' part could also be written without the 'else'. That is outside the last if.
Attachment #617199 - Flags: review?(mkanat)
Attachment #617199 - Flags: review?(LpSolit)
Comment on attachment 617199 [details] [diff] [review] V1 >- return $class->request_cache->{error_mode} >- || (i_am_cgi() ? ERROR_MODE_WEBPAGE : ERROR_MODE_DIE); >+ if (exists($class->request_cache->{error_mode}) { There is a missing closing parenthesis. >+ return $class->request_cache->{error_mode}; >+ } >+ else { >+ return (i_am_cgi() ? ERROR_MODE_WEBPAGE : ERROR_MODE_DIE); >+ } As for bug 645427, I will add a comment about making the code cleaner once we require Perl 5.10.1. r=LpSolit
Attachment #617199 - Flags: review?(mkanat)
Attachment #617199 - Flags: review?(LpSolit)
Attachment #617199 - Flags: review+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla.pm Committed revision 8214.
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.

Attachment

General

Creator:
Created:
Updated:
Size: