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.
CC'ing Tomas in at JD's suggestion
(In reply to Andrew Isherwood from comment #1) > CC'ing Tomas in at JD's suggestion You are right. Good catch!
Created attachment 75857 [details] [review] Bug 20886: Do not cast undef to 0 (TO_JSON) We should not cast undefined values to 0.
Any side-effects to expect with this change?
Created attachment 75869 [details] [review] Bug 20886: (sign-off) Koha::Object::TO_JSON indiscriminately casting to integer Works as advertised for me.
Created attachment 75875 [details] [review] Bug 20886: Do not cast undef to 0 (TO_JSON) We should not cast undefined values to 0. Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
We need Tomas's stamp on this one
Created attachment 75883 [details] [review] Bug 20886: Do not cast undef to 0 (TO_JSON) We should not cast undefined values to 0. Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> This was a bug I introduced. I think the fix is right, and if something gets broken for this, it means it was making the wrong assumptions on the data.
Pushed to master for 18.11, awesome work all!
This patch has been pushed to 18.05.x and will be in 18.05.01
Pushed to 17.11.x for
Is this also for 17.11.x ? It looks similar to Bug 18330