[Bug 32232] New: Koha crashes if dateofbirth is 1947-04-27, 1948-04-25, or 1949-04-24
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Bug ID: 32232 Summary: Koha crashes if dateofbirth is 1947-04-27, 1948-04-25, or 1949-04-24 Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: caroline.cyr-la-rose@inlibro.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com I think this only happens if the server/computer is set to an Eastern Canadian timezone. In 1947, 1948 and 1949, Canada decided to switch to daylight saving time at midnight rather than the usual 2am. Therefore, 1947-04-27 00:00:00, 1948-04-25 00:00:00 and 1949-04-24 00:00:00 don't exist in this timezone. Even if borrowers.dateofbirth is set to 'date' (not 'datetime'), Koha crashes, saying the date doesn't exist. I suspect it would happen with any date, but dateofbirth is the most likely (only) field to have dates in those years. To test: 1. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 2. Save the patron --> Error I tested this on production installations in 21.05 and it works fine. Production installations in 22.05, it crashes. -- 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=32232 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |philippe.blouin@inlibro.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Shi Yao Wang <shi-yao.wang@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |shi-yao.wang@inLibro.com --- Comment #1 from Shi Yao Wang <shi-yao.wang@inLibro.com> --- The code fails in sub get_age of Koha/Patron.pm at line:
return $today->subtract_datetime( $date_of_birth )->years;
because $date_of_birth is invalid for time zone America/Toronto -- 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=32232 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=23079 CC| |jonathan.druart+koha@gmail. | |com -- 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=32232 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- That's a tricky one. It looks like dt_from_string() silently will produce a floating timestamp where a valid local timestamp can't be produced. In this particular case, if $today were converted from local to floating, then the age in years should be able to be computed without error. After grepping around a bit, this looks like it could actually be an all right strategy. I was worried about it pushing the problem further down the line, but it looks like dateofbirth is mostly just used for display with this one exception... -- 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=32232 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to Caroline Cyr La Rose from comment #0)
To test: 1. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 2. Save the patron --> Error
To reproduce, you'll likely need to update <timezone></timezone> to include Canada/Eastern in your koha-conf.xml and then restart Plack. -- 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=32232 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | Severity|enhancement |minor -- 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=32232 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Created attachment 149737 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149737&action=edit Bug 32232: Ignore DST when calculating patron age This change calculates patron age using the floating timezone, so that datetimes missing midnight don't cause fatal errors in the comparison. Test plan: 0. Apply patch 1. Change <timezone></timezone> in koha-conf.xml to include Canada/Eastern 2. koha-plack --restart kohadev 3. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 4. Save the patron 5. Patron detail page loads instead of producing fatal error -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 --- Comment #5 from David Cook <dcook@prosentient.com.au> --- Actually, I'm going to amend that to use the same syntax that Jonathan used in bug 23079 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #149737|0 |1 is obsolete| | --- Comment #6 from David Cook <dcook@prosentient.com.au> --- Created attachment 149738 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149738&action=edit Bug 32232: Ignore DST when calculating patron age This change calculates patron age using the floating timezone, so that datetimes missing midnight don't cause fatal errors in the comparison. Test plan: 0. Apply patch 1. Change <timezone></timezone> in koha-conf.xml to include Canada/Eastern 2. koha-plack --restart kohadev 3. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 4. Save the patron 5. Patron detail page loads instead of producing fatal error -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- Btw, it looks like t/db_dependent/Koha/Patrons.t has a unit test that covers this change. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #149738|0 |1 is obsolete| | --- Comment #8 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Created attachment 149754 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149754&action=edit Bug 32232: Ignore DST when calculating patron age This change calculates patron age using the floating timezone, so that datetimes missing midnight don't cause fatal errors in the comparison. Test plan: 0. Apply patch 1. Change <timezone></timezone> in koha-conf.xml to include Canada/Eastern 2. koha-plack --restart kohadev 3. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 4. Save the patron 5. Patron detail page loads instead of producing fatal error Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 --- Comment #9 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Thanks so much David! I can't vouch for the coding part, but the patch does solve the problem of accessing the patron's file. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Marius <marius.mandrescu@inlibro.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=32232 Marius <marius.mandrescu@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #149754|0 |1 is obsolete| | --- Comment #10 from Marius <marius.mandrescu@inlibro.com> --- Created attachment 149758 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=149758&action=edit Bug 32232: Ignore DST when calculating patron age This change calculates patron age using the floating timezone, so that datetimes missing midnight don't cause fatal errors in the comparison. Test plan: 0. Apply patch 1. Change <timezone></timezone> in koha-conf.xml to include Canada/Eastern 2. koha-plack --restart kohadev 3. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 4. Save the patron 5. Patron detail page loads instead of producing fatal error Signed-off-by: Marius Mandrescu <marius.mandrescu@inLibro.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Nick Clemens <nick@bywatersolutions.com> 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=32232 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #149758|0 |1 is obsolete| | --- Comment #11 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 150416 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150416&action=edit Bug 32232: Ignore DST when calculating patron age This change calculates patron age using the floating timezone, so that datetimes missing midnight don't cause fatal errors in the comparison. Test plan: 0. Apply patch 1. Change <timezone></timezone> in koha-conf.xml to include Canada/Eastern 2. koha-plack --restart kohadev 3. Create a patron, setting the date of birth to one of these three dates - 1947-04-27 - 1948-04-25 - 1949-04-24 4. Save the patron 5. Patron detail page loads instead of producing fatal error Signed-off-by: Marius Mandrescu <marius.mandrescu@inLibro.com> 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=32232 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.05. 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=32232 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.05.00 |23.05.00,22.11.06 released in| | Status|Pushed to master |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 --- Comment #13 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Nice work everyone! Pushed to stable for 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable CC| |lucas@bywatersolutions.com Version(s)|23.05.00,22.11.06 |23.05.00,22.11.06,22.05.14 released in| | --- Comment #14 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 22.05.x for upcoming 22.05.14 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32232 Danyon Sewell <danyonsewell@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |danyonsewell@catalyst.net.n | |z Status|Pushed to oldstable |RESOLVED --- Comment #15 from Danyon Sewell <danyonsewell@catalyst.net.nz> --- Not backporting to 21.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org