Summary: | tools/viewlog.pl does not compile in older perls | ||
---|---|---|---|
Product: | Koha | Reporter: | Colin Campbell <colin.campbell> |
Component: | Tools | Assignee: | Colin Campbell <colin.campbell> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | chris, fridolin.somers, jonathan.druart, mtj, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13544 | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 11331 | ||
Bug Blocks: | |||
Attachments: |
Proposed patch
Bug 13522: Make it explicit that scalar containd a hash ref [PASSED QA] Bug 13522: Make it explicit that scalar containd a hash ref |
Description
Colin Campbell
2015-01-06 10:50:47 UTC
Created attachment 34978 [details] [review] Proposed patch To test. you need a perl version prior to 5.12 without the patch perl -wc tools/viewlog.pl gives the syntax error from the bug description and fails to compile wit the patch applied it should compile correctly *** Bug 13538 has been marked as a duplicate of this bug. *** Created attachment 35034 [details] [review] 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> I had exactly the same patch. I consider this as major since the page is not accessible at all. I tested it on a sandbox (perl 5.10.1). 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> 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 ? (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. Patch pushed to master. Thanks Colin! Pushed to 3.18.x, will be in 3.18.3 Pushed to 3.16.x, will be in 3.16.7 |