sort (...) interpreted as function at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 25950. It starts happening after that commit: d659526b5a Bug 38664: Tidy the whole codebase A more minimal example can be reproduced: ``` my $var_with_long_name_1 = "2019-10-30"; my $var_with_long_name_2 = "2005-01-10"; my $var_with_long_name_3 = "2010-02-01"; # no warning my ($max_value1) = sort ( $var_with_long_name_1, $var_with_long_name_2, $var_with_long_name_3 ); warn $max_value1; # sort (...) interpreted as function my ($max_value2) = sort ( $var_with_long_name_1, $var_with_long_name_2, $var_with_long_name_3 ); # sort (...) interpreted as function my ($max_value3) = sort ( $var_with_long_name_1, $var_with_long_name_2, $var_with_long_name_3 ); # sort (...) interpreted as function my ($max_value4) = sort ( $var_with_long_name_1, $var_with_long_name_2, $var_with_long_name_3 ); ``` perl -w test.pl sort (...) interpreted as function at test.pl line 11. sort (...) interpreted as function at test.pl line 15. sort (...) interpreted as function at test.pl line 20. 2005-01-10 at test.pl line 8. So somehow perl doesn't like when here the args aren't in the same line. And the sorting is ascending so it gets the min value when it seems the intent was to get the max value! https://gitlab.com/koha-community/Koha/-/blob/93eda45a9e6d492161096a0536a195bd257b02f3/installer/data/mysql/updatedatabase.pl?page=26#L25950 > my ($max_date) = sort ( $suggestion->{manageddate} || (), $suggestion->{accepteddate} || (), > $suggestion->{rejecteddate} || () );
So I guess it can be fixed either by looking at that weird perl behavior. Or by fixing that old DB rev so it actually gets the max_date. Assuming that's correct functionally. A fix might change the code enough to avoid the weird warning. Just reversing the sort with { $b cmp $a } avoids the warning ^^" my ($max_value2) = sort { $b cmp $a } ( $var_with_long_name_1, $var_with_long_name_2, $var_with_long_name_3 ); ---- Should severity be major because it might cause doubt on whether upgrade failed or worked?
Done in bug 38664: Fix updatedatabase.pl *** This bug has been marked as a duplicate of bug 38664 ***