[Bug 8761] New: Correct compile time warnings in C4::Circulation
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Priority: P5 - low Change sponsored?: --- Bug ID: 8761 Assignee: gmcharlt@gmail.com Summary: Correct compile time warnings in C4::Circulation Severity: minor Classification: Unclassified OS: All Reporter: colin.campbell@ptfs-europe.com Hardware: All Status: NEW Version: master Component: Architecture, internals, and plumbing Product: Koha A recent enhancement to C4::Circulation has introduced some ambiguous constructs which on current perls give compile time warnings with perl 5.16.0 or 5.16.1 (I've not tested with older) if you check compilation with perl -wc C4/Circulation.pm you get the following warnings Scalar value @values[$take] better written as $values[$take] at Circulation.pm line 985. Scalar value @alloweddate[0] better written as $alloweddate[0] at Circulation.pm line 991. Scalar value @alloweddate[1] better written as $alloweddate[1] at Circulation.pm line 993. Scalar value @alloweddate[2] better written as $alloweddate[2] at Circulation.pm line 993. Scalar value @alloweddate[2] better written as $alloweddate[2] at Circulation.pm line 994. Heres the doc from perlwarn (W syntax) You've used an array slice (indicated by @) to select a single element of an array. Generally it's better to ask for a scalar value (indicated by $). The difference is that $foo[&bar] always behaves like a scalar, both when assigning to it and when evaluating its argument, while @foo[&bar] behaves like a list when you assign to it, and provides a list context to its subscript, which can do weird things if you're expecting only one subscript. On the other hand, if you were actually hoping to treat the array element as a list, you need to look into how references work, because Perl will not magically convert between scalars and lists for you. See perlref. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Colin Campbell <colin.campbell@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|gmcharlt@gmail.com |colin.campbell@ptfs-europe. | |com --- Comment #1 from Colin Campbell <colin.campbell@ptfs-europe.com> --- Created attachment 12144 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12144&action=edit Proposed Patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 --- Comment #2 from Colin Campbell <colin.campbell@ptfs-europe.com> --- Doc is perldiag not perlwarn -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz --- Comment #3 from Chris Cormack <chris@bigballofwax.co.nz> --- The warns are the same with 5.14 too. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 --- Comment #4 from Chris Cormack <chris@bigballofwax.co.nz> --- I can confirm the patch makes the error goes away, and circ still works fine. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #12144|0 |1 is obsolete| | --- Comment #5 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 12159 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=12159&action=edit Bug 8761 Dont inadvertantly use slices Assignment to a single element slice is better written as a scalar - This generates a compile time warning as it can lead to odd behaviour see perldiag for details This corrects some cases which were added in a recent commit Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m QA Contact| |jonathan.druart@biblibre.co | |m -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #6 from Jonathan Druart <jonathan.druart@biblibre.com> --- I proposed exactly the same patch in Bug 7621 (which introduces these warnings). So I mark it as Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |paul.poulain@biblibre.com Version|master |rel_3_8 --- Comment #7 from Paul Poulain <paul.poulain@biblibre.com> --- Patch pushed to master +1 to karma colin ;-) Chris_c = not sure this is needed or applying on 3.8 though -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> --- Released in 3.10.0 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org