Bugzilla – Attachment 21290 Details for
Bug 10900
Incorrect calling conventions accessing C4::Context
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Correct calling convention for set_userenv
0001-Bug-10900-Incorrect-calling-conventions-accessing-C4.patch (text/plain), 5.41 KB, created by
Mark Tompsett
on 2013-09-21 04:31:36 UTC
(
hide
)
Description:
Correct calling convention for set_userenv
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2013-09-21 04:31:36 UTC
Size:
5.41 KB
patch
obsolete
>From 651f1908978f35ddb094520d872bb988b2a820e5 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 20 Sep 2013 21:36:46 -0400 >Subject: [PATCH 1/3] Bug 10900 - Incorrect calling conventions accessing > C4::Context > >There were multiple calling conventions for C4::Context's >set_userenv routine. So the following commands were used to >find discrepancies: > grep "::set_userenv" `find .` > grep "\->set_userenv" `find .` > >The first grep demonstrated that the smaller change is from >:: to -> as only C4/Auth.pm, installer/InstallAuth.pm, and >t/db_dependent/Circulation.t would need to be modified. This >patch corrects C4::Context's set_userenv routine to be object >call based (use ->) by using a shift to ignore the first >parameter, and modify the three files found with :: calls. >--- > C4/Auth.pm | 10 +++++----- > C4/Context.pm | 1 + > installer/InstallAuth.pm | 4 ++-- > t/db_dependent/Circulation.t | 2 +- > 4 files changed, 9 insertions(+), 8 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 1e17e59..e9f459b 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -642,7 +642,7 @@ sub checkauth { > C4::Context->_new_userenv($sessionID); > my ($ip, $lasttime, $sessiontype); > if ($session){ >- C4::Context::set_userenv( >+ C4::Context->set_userenv( > $session->param('number'), $session->param('id'), > $session->param('cardnumber'), $session->param('firstname'), > $session->param('surname'), $session->param('branch'), >@@ -915,7 +915,7 @@ sub checkauth { > if ($persona){ > $session->param('persona',1); > } >- C4::Context::set_userenv( >+ C4::Context->set_userenv( > $session->param('number'), $session->param('id'), > $session->param('cardnumber'), $session->param('firstname'), > $session->param('surname'), $session->param('branch'), >@@ -1146,7 +1146,7 @@ sub check_api_auth { > my $session = get_session($sessionID); > C4::Context->_new_userenv($sessionID); > if ($session) { >- C4::Context::set_userenv( >+ C4::Context->set_userenv( > $session->param('number'), $session->param('id'), > $session->param('cardnumber'), $session->param('firstname'), > $session->param('surname'), $session->param('branch'), >@@ -1306,7 +1306,7 @@ sub check_api_auth { > $session->param('ip',$session->remote_addr()); > $session->param('lasttime',time()); > } >- C4::Context::set_userenv( >+ C4::Context->set_userenv( > $session->param('number'), $session->param('id'), > $session->param('cardnumber'), $session->param('firstname'), > $session->param('surname'), $session->param('branch'), >@@ -1385,7 +1385,7 @@ sub check_cookie_auth { > my $session = get_session($sessionID); > C4::Context->_new_userenv($sessionID); > if ($session) { >- C4::Context::set_userenv( >+ C4::Context->set_userenv( > $session->param('number'), $session->param('id'), > $session->param('cardnumber'), $session->param('firstname'), > $session->param('surname'), $session->param('branch'), >diff --git a/C4/Context.pm b/C4/Context.pm >index 739a0ec..25a06ce 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -1111,6 +1111,7 @@ set_userenv is called in Auth.pm > > #' > sub set_userenv { >+ shift @_; > my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= @_; > my $var=$context->{"activeuser"} || ''; > my $cell = { >diff --git a/installer/InstallAuth.pm b/installer/InstallAuth.pm >index 0015a14..1aafe70 100644 >--- a/installer/InstallAuth.pm >+++ b/installer/InstallAuth.pm >@@ -250,7 +250,7 @@ sub checkauth { > new CGI::Session( "driver:File;serializer:yaml", $sessionID, > { Directory => '/tmp' } ); > if ( $session->param('cardnumber') ) { >- C4::Context::set_userenv( >+ C4::Context->set_userenv( > $session->param('number'), > $session->param('id'), > $session->param('cardnumber'), >@@ -312,7 +312,7 @@ sub checkauth { > #Only superlibrarian should have access to this page. > #Since if it is a user, it is supposed that there is a borrower table > #And thus that data structure is loaded. >- my $hash = C4::Context::set_userenv( >+ my $hash = C4::Context->set_userenv( > 0, 0, > C4::Context->config('user'), C4::Context->config('user'), > C4::Context->config('user'), "", >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 60b93e2..7160409 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -77,7 +77,7 @@ is( > > diag('Now, set a userenv'); > C4::Context->_new_userenv('xxx'); >-C4::Context::set_userenv(0,0,0,'firstname','surname', 'MPL', 'Midway Public Library', '', '', ''); >+C4::Context->set_userenv(0,0,0,'firstname','surname', 'MPL', 'Midway Public Library', '', '', ''); > is(C4::Context->userenv->{branch}, 'MPL', 'userenv set'); > > # Userenv set, PickupLibrary >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10900
:
21152
|
21263
|
21290
|
21291
|
21292
|
22037
|
22038
|
22585
|
22937
|
27729
|
28183
|
30243
|
30244
|
31297
|
31298
|
31719
|
31720
|
31721
|
34355
|
34356
|
34357
|
35542
|
35543
|
35544