Bugzilla – Attachment 131130 Details for
Bug 29771
Get rid of CGI::param in list context warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29771: Scalar context for split
Bug-29771-Scalar-context-for-split.patch (text/plain), 4.10 KB, created by
Nick Clemens (kidclamp)
on 2022-02-25 19:20:27 UTC
(
hide
)
Description:
Bug 29771: Scalar context for split
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-02-25 19:20:27 UTC
Size:
4.10 KB
patch
obsolete
>From 37cea6f58aee8729ae1f277aaf700fd967010609 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 23 Dec 2021 16:58:57 -0300 >Subject: [PATCH] Bug 29771: Scalar context for split > >This patch tackles a very specific scenario. Calling split(..., >CGI::param) makes it be called in list context. The split docs say: > >split /PATTERN/,EXPR,LIMIT > >this means the first CGI param will be used as EXPR and the second one >as LIMIT, which is wrong anyway. So the fix is to just force scalar >context. > >To test: >1. Not sure, just make sure nothing breaks when using the scripts in the > browser. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > circ/article-request-slip.pl | 2 +- > circ/waitingreserves.pl | 2 +- > reserve/request.pl | 2 +- > tools/batch_delete_records.pl | 2 +- > tools/batch_record_modification.pl | 2 +- > tools/inventory.pl | 2 +- > 6 files changed, 6 insertions(+), 6 deletions(-) > >diff --git a/circ/article-request-slip.pl b/circ/article-request-slip.pl >index 2efd4953f7..f31eac72d0 100755 >--- a/circ/article-request-slip.pl >+++ b/circ/article-request-slip.pl >@@ -30,7 +30,7 @@ use Koha::Patrons; > > my $cgi = CGI->new; > >-my @ids = split( ',', $cgi->param('id') ); >+my @ids = split( ',', scalar $cgi->param('id') ); > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > { >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index d71c53bb77..608fb49d3f 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -75,7 +75,7 @@ $template->param( all_branches => 1 ) if $all_branches; > > if ($cancelBulk) { > my $reason = $input->param("cancellation-reason"); >- my @hold_ids = split ',', $input->param("ids"); >+ my @hold_ids = split( ',', scalar $input->param("ids") ); > my $params = { > reason => $reason, > hold_ids => \@hold_ids, >diff --git a/reserve/request.pl b/reserve/request.pl >index 9e917a0887..d352c726c3 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -129,7 +129,7 @@ elsif ( $action eq 'toggleSuspend' ) { > } > elsif ( $action eq 'cancelBulk' ) { > my $cancellation_reason = $input->param("cancellation-reason"); >- my @hold_ids = split ',', $input->param("ids"); >+ my @hold_ids = split( ',', scalar $input->param("ids")); > my $params = { > reason => $cancellation_reason, > hold_ids => \@hold_ids, >diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl >index b09f781818..923c902f04 100755 >--- a/tools/batch_delete_records.pl >+++ b/tools/batch_delete_records.pl >@@ -85,7 +85,7 @@ if ( $op eq 'form' ) { > } > } else { > # The user enters manually the list of id >- push @record_ids, split( /\s\n/, $input->param('recordnumber_list') ); >+ push @record_ids, split( /\s\n/, scalar $input->param('recordnumber_list') ); > } > > for my $record_id ( uniq @record_ids ) { >diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl >index dab8910453..1cbda22785 100755 >--- a/tools/batch_record_modification.pl >+++ b/tools/batch_record_modification.pl >@@ -113,7 +113,7 @@ if ( $op eq 'form' ) { > } > } else { > # The user enters manually the list of id >- push @record_ids, split( /\s\n/, $input->param('recordnumber_list') ); >+ push @record_ids, split( /\s\n/, scalar $input->param('recordnumber_list') ); > } > > for my $record_id ( uniq @record_ids ) { >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 48de7e9c5c..3400c70d11 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -182,7 +182,7 @@ if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length > push @uploadedbarcodes, grep { /\S/ } split( /[$split_chars]/, $barcode ); > } > } else { >- push @uploadedbarcodes, split(/\s\n/, $input->param('barcodelist') ); >+ push @uploadedbarcodes, split(/\s\n/, scalar $input->param('barcodelist') ); > $uploadbarcodes = $barcodelist; > } > for my $barcode (@uploadedbarcodes) { >-- >2.30.2
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 29771
:
128908
|
128909
|
128910
|
131129
|
131130
|
131187
|
131188