In the KohaDates filter we process our passed date using dt_from_string before passing it to output_pref. dt_from_string handles bad dates in an eval block, falling back to assigning a floating timezone. However, in the subsequent call to output_pref we try to set the timezone a second time and this time it is not in an eval and so will throw an internal server error for such dates.
Created attachment 133290 [details] [review] Bug 30540: eval on set_time_zone This patch adds an eval around the call to set_time_zone so that we don't crash on invalid local dates and instead just keep the passed floating timezone.
2017-03-26 01:35:00 is such a date in Europe/London time.. it's a DST boundary day so anything between 12.59.59 and 02.00.00 doesn't exist ;) Set any checkout date in the database to this and set your tz config to Europe/London and you'll find the issuehistory page will crash without the patch here. Unit test to follow.. once my brain has worked out how to write one.
Created attachment 133292 [details] [review] Bug 30540: Unit test This patch adds tests for checking the output_pref method against a timezone and datetime that would cause an Invalid local time failure To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/DateUtils.t => FAIL: The feature is not implemented, tests fail to complete
Created attachment 133293 [details] [review] Bug 30540: eval on set_time_zone This patch adds an eval around the call to set_time_zone so that we don't crash on invalid local dates and instead just keep the passed floating timezone.
Created attachment 133297 [details] [review] Bug 30540: Unit test This patch adds tests for checking the output_pref method against a timezone and datetime that would cause an Invalid local time failure To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/DateUtils.t => FAIL: The feature is not implemented, tests fail to complete Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 133298 [details] [review] Bug 30540: eval on set_time_zone This patch adds an eval around the call to set_time_zone so that we don't crash on invalid local dates and instead just keep the passed floating timezone. Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 133299 [details] [review] Bug 30540: Fix perl critic complaint of leading zeros Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 133336 [details] [review] Bug 30540: Unit test This patch adds tests for checking the output_pref method against a timezone and datetime that would cause an Invalid local time failure To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/DateUtils.t => FAIL: The feature is not implemented, tests fail to complete Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 133337 [details] [review] Bug 30540: eval on set_time_zone This patch adds an eval around the call to set_time_zone so that we don't crash on invalid local dates and instead just keep the passed floating timezone. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 133338 [details] [review] Bug 30540: Fix perl critic complaint of leading zeros Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Please rebase and ping me if needed in 21.11, I tried but get an error on the unit test.
Pushed to 21.11.x for 21.11.06
Pushed to 21.05.x for 21.05.15
Backported: Pushed to 20.11.x branch for 20.11.19
Does this need to be backported to 19.11.x?