[Bug 18539] New: Forbid Koha::Objects->find calls in list context
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Bug ID: 18539 Summary: Forbid Koha::Objects->find calls in list context Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: jonathan.druart@bugs.koha-community.org QA Contact: testopia@bugs.koha-community.org See bug 18179 for more info. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |jonathan.druart@bugs.koha-c | |ommunity.org Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |18179 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18179 [Bug 18179] Koha::Objects->find should not be called in list context -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 63110 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=63110&action=edit Bug 18539: Forbid list context calls for Koha::Objects->find Reading https://perlmaven.com/how-to-return-undef-from-a-function this sound like the more correct behaviour. Considering: $template->param( stuff => Koha::Stuffs->find( $id ), foo => 1, ); without this patch, if the $id does not represent any rows in the DB, stuff will be assigned to 'foo' and $foo will be undef in the template. That can lead to very bad side-effects. With this patch we make sure that it will never happen again. Test plan: prove t/db_dependent/Koha/Objects.t should return green Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 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=18539 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #63110|0 |1 is obsolete| | CC| |kyle@bywatersolutions.com Status|Signed Off |Passed QA Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |18361 --- Comment #2 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 64338 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64338&action=edit Bug 18539: Forbid list context calls for Koha::Objects->find Reading https://perlmaven.com/how-to-return-undef-from-a-function this sound like the more correct behaviour. Considering: $template->param( stuff => Koha::Stuffs->find( $id ), foo => 1, ); without this patch, if the $id does not represent any rows in the DB, stuff will be assigned to 'foo' and $foo will be undef in the template. That can lead to very bad side-effects. With this patch we make sure that it will never happen again. Test plan: prove t/db_dependent/Koha/Objects.t should return green Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18361 [Bug 18361] Koha::Objects->find should accept composite primary keys -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 64351 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=64351&action=edit Bug 18539: remove occurrence in ReNewSubscription.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 17.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED CC| |fridolin.somers@biblibre.co | |m --- Comment #5 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Enhancement not pushed to 17.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 --- Comment #6 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Actual patch Bug 18539: remove occurrence in ReNewSubscription.t contains the remove of t/db_dependent/00-strict.t. But I see this was not pushed into master : http://git.koha-community.org/gitweb/?p=koha.git;a=commit;h=ad7ff09b995e5275... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 --- Comment #7 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- I finally to push to 17.05.x to be able to push Bug 18361. Will be in 17.05.03. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #64351|0 |1 is obsolete| | --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 65458 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=65458&action=edit Bug 18539: remove occurrence in ReNewSubscription.t Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- These patches have been pushed to 16.11.x and will be in 16.11.11. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |19695 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19695 [Bug 19695] Uncertain prices should not use find in list context -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18539 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |19809 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19809 [Bug 19809] Koha::Objects::find calls do not need to be forbidden in list context -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org