[Bug 30781] New: Use of uninitialized value $val in substitution iterator at /usr/share/koha/lib/C4/Letters.pm line 665.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Bug ID: 30781 Summary: Use of uninitialized value $val in substitution iterator at /usr/share/koha/lib/C4/Letters.pm line 665. Change sponsored?: --- Product: Koha Version: 20.11 Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz In our installation 20.11.17 it's these lines: if (%$substitute) { while ( my ($token, $val) = each %$substitute ) { if ( $token eq 'items.content' ) { $val =~ s|\n|<br/>|g if $letter->{is_html}; } --> $letter->{title} =~ s/<<$token>>/$val/g; $letter->{content} =~ s/<<$token>>/$val/g; } } Itemscontent is used as: koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/overdue_notices.pl -t -itemscontent date_due,title,subtitle,part_number,part_name,author,itemcallnumber,barcode koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/advance_notices.pl -c --itemscontent date_due,title,subtitle,part_number,part_name,author,itemcallnumber,barcode This creates quite a bit of noise from the cronjobs, so it would be nice to get a hint on how to fix this or a patch. In master the code in question is unchanged. -- 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=30781 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25790 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- 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=30781 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com --- Comment #1 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- That could be fixed with the following change. diff --git a/C4/Letters.pm b/C4/Letters.pm index 9ed1de0e44f..8ab0bb727e0 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -599,6 +599,7 @@ sub GetPreparedLetter { if (%$substitute) { while ( my ($token, $val) = each %$substitute ) { + $val //= q{}; if ( $token eq 'items.content' ) { $val =~ s|\n|<br/>|g if $letter->{is_html}; } -- 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=30781 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Assignee|koha-bugs@lists.koha-commun |fridolin.somers@biblibre.co |ity.org |m -- 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=30781 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=30781 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff 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=30781 --- Comment #2 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 135177 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135177&action=edit Bug 30781: Add unit test for substitute with undefined value Add unit test that generates warn. This may be usefull as no regression test. Run prove t/db_dependent/Letters.t You see warn : t/db_dependent/Letters.t .. 1/84 Use of uninitialized value $val in substitution iterator at /kohadevbox/koha/C4/Letters.pm line 607. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 --- Comment #3 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 135178 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135178&action=edit Bug 30781: Fix warning in GetPreparedLetter Test by running : prove t/db_dependent/Letters.t Check you dont see warning : Use of uninitialized value $val in substitution iterator -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|20.11 |unspecified Status|Needs Signoff |Failed QA --- Comment #4 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- To test that a subroutine call does not produce a warning you should use warning_is. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 --- Comment #5 from Fridolin Somers <fridolin.somers@biblibre.com> --- (In reply to Jonathan Druart from comment #4)
To test that a subroutine call does not produce a warning you should use warning_is.
Ah OK. I keep the test on the build of letter content and add a new for the warning. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135177|0 |1 is obsolete| | --- Comment #6 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 135192 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135192&action=edit Bug 30781: Add unit test for substitute with undefined value Add unit test that generates warn. This may be usefull as no regression test. Run prove t/db_dependent/Letters.t You see warn : t/db_dependent/Letters.t .. 1/84 Use of uninitialized value $val in substitution iterator at /kohadevbox/koha/C4/Letters.pm line 607. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135178|0 |1 is obsolete| | --- Comment #7 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 135193 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135193&action=edit Bug 30781: Fix warning in GetPreparedLetter Test by running : prove t/db_dependent/Letters.t Check you dont see warning : Use of uninitialized value $val in substitution iterator -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 David Nind <david@davidnind.com> 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=30781 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135192|0 |1 is obsolete| | --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 135219 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135219&action=edit Bug 30781: Add unit test for substitute with undefined value Add unit test that generates warn. This may be usefull as no regression test. Run prove t/db_dependent/Letters.t You see warn : t/db_dependent/Letters.t .. 1/84 Use of uninitialized value $val in substitution iterator at /kohadevbox/koha/C4/Letters.pm line 607. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135193|0 |1 is obsolete| | --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 135220 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135220&action=edit Bug 30781: Fix warning in GetPreparedLetter Test by running : prove t/db_dependent/Letters.t Check you dont see warning : Use of uninitialized value $val in substitution iterator Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135220|0 |1 is obsolete| | --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 135222 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135222&action=edit Bug 30781: Fix warning in GetPreparedLetter Test by running : prove t/db_dependent/Letters.t Check you dont see warning : Use of uninitialized value $val in substitution iterator Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_22_11_candidate QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | Status|Passed QA |Signed Off CC| |m.de.rooy@rijksmuseum.nl --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QAing. Not for this release -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Marcel de Rooy from comment #11)
QAing. Not for this release
Too late -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- I wanted to add this remark: We could have a theoretical debate if you should allow the substitution if you pass an undefined value. What we do now, is formalize what already happened but silence the warning. But we could also choose to skip this substitution since you should not pass undefined substitution parameters. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_22_11_candidate | CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.11.00 |22.11.00, 22.05.01 released in| | Status|Pushed to master |Pushed to stable CC| |lucas@bywatersolutions.com --- Comment #15 from Lucas Gass <lucas@bywatersolutions.com> --- Pushed to 22.05.x for 22.05.01 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.suzuki@biblibre.com Version(s)|22.11.00, 22.05.01 |22.11.00, 22.05.01, released in| |21.11.07 Status|Pushed to stable |Pushed to oldstable --- Comment #16 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- thx, pushed to 21.11.x for 21.11.07 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |RESOLVED CC| |victor@tuxayo.net Resolution|--- |FIXED --- Comment #17 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document, marking resolved. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 --- Comment #18 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I've ported this to 20.11 as it creates a lot of noise, might be nice in 21.05 as well. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30781 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.11.00, 22.05.01, |22.11.00, 22.05.01, released in|21.11.07 |21.11.07, 21.05.16 --- Comment #19 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Backported: Pushed to 21.05.x branch for 21.05.16 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org