From e98fe7e32244fa11d218b4d2a1006eea547e70d8 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Thu, 4 Apr 2013 10:54:03 +0100 Subject: [PATCH] Bug 6554 Fix error caused by modifying $_ in a map Error 'Modification of a read-only value attempted' triggered on login because of manipulation of $_ in the map Moved the mod to a loop as recommended in the doc for map Signed-off-by: Marcel de Rooy Signed-off-by: Jared Camins-Esakov --- C4/Context.pm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 4d170b2fb6..fee87520c9 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1104,9 +1104,22 @@ set_userenv is called in Auth.pm #' sub set_userenv { - my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= - map { utf8::decode($_); $_ } # CGI::Session doesn't handle utf-8, so we decode it here - @_; + my ( + $usernum, $userid, $usercnum, $userfirstname, + $usersurname, $userbranch, $branchname, $userflags, + $emailaddress, $branchprinter, $persona + ) = @_; + for ( + $usernum, $userid, $usercnum, $userfirstname, + $usersurname, $userbranch, $branchname, $userflags, + $emailaddress, $branchprinter, $persona + ) + { + utf8::decode($_) if $_; + } + + # CGI::Session doesn't handle utf-8, so we decode it here + my $var=$context->{"activeuser"} || ''; my $cell = { "number" => $usernum, -- 2.39.5