[Bug 20886] New: Koha::Object::TO_JSON indiscriminately casting to integer
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@lists.koha-community.org Reporter: andrew.isherwood@ptfs-europe.com QA Contact: testopia@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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #1 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- CC'ing Tomas in at JD's suggestion -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |20797 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20797 [Bug 20797] If an Ill request has an associated bib record, the detail view should contain a link to the record -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Andrew Isherwood from comment #1)
CC'ing Tomas in at JD's suggestion
You are right. Good catch! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org CC| |jonathan.druart@bugs.koha-c | |ommunity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 75857 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=75857&action=edit Bug 20886: Do not cast undef to 0 (TO_JSON) We should not cast undefined values to 0. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Any side-effects to expect with this change? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #75857|0 |1 is obsolete| | Assignee|jonathan.druart@bugs.koha-c |andrew.isherwood@ptfs-europ |ommunity.org |e.com Status|Needs Signoff |Signed Off CC| |andrew.isherwood@ptfs-europ | |e.com --- Comment #5 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 75869 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=75869&action=edit Bug 20886: (sign-off) Koha::Object::TO_JSON indiscriminately casting to integer Works as advertised for me. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #75869|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 75875 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=75875&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|andrew.isherwood@ptfs-europ |jonathan.druart@bugs.koha-c |e.com |ommunity.org QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- We need Tomas's stamp on this one -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #75875|0 |1 is obsolete| | --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 75883 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=75883&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #9 from Nick Clemens <nick@bywatersolutions.com> --- Pushed to master for 18.11, awesome work all! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- This patch has been pushed to 18.05.x and will be in 18.05.01 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=18330 --- Comment #11 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Pushed to 17.11.x for -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 --- Comment #12 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Is this also for 17.11.x ? It looks similar to Bug 18330 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Stable |RESOLVED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20886 Andrew Isherwood <bugzilla@warmlight.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|bugzilla@warmlight.co.uk | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org