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
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