[Koha-bugs] [Bug 20886] New: Koha::Object::TO_JSON indiscriminately casting to integer

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 6 12:15:00 CEST 2018


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

            Bug ID: 20886
           Summary: Koha::Object::TO_JSON indiscriminately casting to
                    integer
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: andrew.isherwood at ptfs-europe.com
        QA Contact: testopia at bugs.koha-community.org

As noted in bug 20797 there appears to be a bug in Koha::Object::TO_JSON.
Specifically:

elsif ( _numeric_column_type( $columns_info->{$col}->{data_type} ) ) {

    # TODO: Remove once the solution for
    # https://rt.cpan.org/Ticket/Display.html?id=119904
    # is ported to whatever distro we support by that time
    $unblessed->{$col} += 0;
}

Here we are explicitly casting to an integer to workaround an upstream bug.
This works fine unless the data in question comes from a numeric type column
but is NULL, in which case it is cast to 0.

I suspect the desired behaviour here is for it to remain unaltered unless the
value is also numeric.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list