From 762415a2ff18e5a1b783f8eff2275e7d47216343 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sat, 9 Jul 2016 13:13:35 +0100 Subject: [PATCH] Bug 16886: Make the 'Upload patron images' tool plack safe Some vars are accessed from subroutine, but defined with my. It causes at least the 2 followings errors: Variable "$filetype" is not available at /home/koha/src/tools/picture-upload.pl line 240. Variable "$uploadfilename" is not available at /home/koha/src/tools/picture-upload.pl line 241. To avoid that, they are now declared with our. Test plan: Upload image for a patron and confirm that you get a "Result" table and the errors do not longer appear in the logs. Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- tools/picture-upload.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl index 7091b58055..9892eb5d17 100755 --- a/tools/picture-upload.pl +++ b/tools/picture-upload.pl @@ -46,9 +46,9 @@ my ($template, $loggedinuser, $cookie) debug => 0, }); -my $filetype = $input->param('filetype'); +our $filetype = $input->param('filetype') || ''; my $cardnumber = $input->param('cardnumber'); -my $uploadfilename = $input->param('uploadfile'); +our $uploadfilename = $input->param('uploadfile') || ''; my $uploadfile = $input->upload('uploadfile'); my $borrowernumber = $input->param('borrowernumber'); my $op = $input->param('op') || ''; @@ -76,7 +76,9 @@ Files greater than 100K will be refused. Images should be 140x200 pixels. If the $debug and warn "Operation requested: $op"; -my ( $total, $handled, @counts, $tempfile, $tfh, %errors ); +my ( $total, $handled, $tempfile, $tfh ); +our @counts = (); +our %errors = (); # Case is important in these operational values as the template must use case to be visually pleasing! if ( ( $op eq 'Upload' ) && $uploadfile ) { -- 2.39.5