Bug 13522 - tools/viewlog.pl does not compile in older perls
Summary: tools/viewlog.pl does not compile in older perls
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Colin Campbell
QA Contact: Testopia
URL:
Keywords:
: 13538 (view as bug list)
Depends on: 11331
Blocks:
  Show dependency treegraph
 
Reported: 2015-01-06 10:50 UTC by Colin Campbell
Modified: 2016-06-21 21:36 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (1.12 KB, patch)
2015-01-06 11:51 UTC, Colin Campbell
Details | Diff | Splinter Review
Bug 13522: Make it explicit that scalar containd a hash ref (1.18 KB, patch)
2015-01-08 12:19 UTC, Jonathan Druart
Details | Diff | Splinter Review
[PASSED QA] Bug 13522: Make it explicit that scalar containd a hash ref (1.26 KB, patch)
2015-01-09 11:55 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Campbell 2015-01-06 10:50:47 UTC
Attempting to view logs on a system with a perl older than 5.12 gives the following compile time error:
Type of arg 1 to keys must be hash (not array element) at viewlog.pl line 214, near "];"

Prior to 5.12 keys could only be called on a hash sites using 5.10 cannot use viewlog as a result
Comment 1 Colin Campbell 2015-01-06 11:51:53 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2015-01-08 12:15:49 UTC
*** Bug 13538 has been marked as a duplicate of this bug. ***
Comment 3 Jonathan Druart 2015-01-08 12:19:53 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-01-08 12:20:37 UTC
I had exactly the same patch.
I consider this as major since the page is not accessible at all.
Comment 5 Jonathan Druart 2015-01-08 12:21:17 UTC
I tested it on a sandbox (perl 5.10.1).
Comment 6 Kyle M Hall 2015-01-09 11:55:07 UTC
Created attachment 35041 [details] [review]
[PASSED QA] Bug 13522: Make it explicit that scalar containd a hash ref

Prior to perl 5.12 keys can only operate on a hash. So although
$data[0] ( thats an abysmal variable name! ) will contain a hash ref
the perl compiler cannot deduce that from the context and gives
a syntax error. Add the hash sigil to make the context explicit and
the compiler can generate the correct code.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Fridolin Somers 2015-01-09 14:39:35 UTC
Sorry for this bug.

In the same context, have a look at admin/auth_subfields_structure.pl, Line 102 :
  my @authtypes = (sort keys getauthtypes);
getauthtypes return a harsh ref, not a hash.
Is it also a dangerous code ?
Comment 8 Jonathan Druart 2015-01-09 14:53:49 UTC
(In reply to Fridolin SOMERS from comment #7)
> Sorry for this bug.
> 
> In the same context, have a look at admin/auth_subfields_structure.pl, Line
> 102 :
>   my @authtypes = (sort keys getauthtypes);
> getauthtypes return a harsh ref, not a hash.
> Is it also a dangerous code ?

Good catch, I have opened bug 13544.
Comment 9 Tomás Cohen Arazi 2015-01-10 19:19:27 UTC
Patch pushed to master.

Thanks Colin!
Comment 10 Chris Cormack 2015-01-14 23:43:38 UTC
Pushed to 3.18.x, will be in 3.18.3
Comment 11 Mason James 2015-01-16 23:36:28 UTC
Pushed to 3.16.x, will be in 3.16.7