https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39101

            Bug ID: 39101
           Summary: warning: "sort (...) interpreted as function"  when
                    running updatedatabase
 Change sponsored?: ---
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Installation and upgrade (command-line installer)
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]

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} || () );

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to