[Koha-bugs] [Bug 14936] Add validation for date strings to Koha::DateUtils
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Oct 2 09:17:55 CEST 2015
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14936
Jonathan Druart <jonathan.druart at bugs.koha-community.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jonathan.druart at bugs.koha-c
| |ommunity.org
--- Comment #5 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Marc,
This is not the way to go, for several reasons.
The main reason is that you c/p dt_from_string to create the new subroutine,
which is bad.
Then, if you have a look at dt_from_string, you will note 1 eval around the
first DateTime->new (l. 156), but not around the second one (l. 164).
So I think there are at least 2 better ways to know if a date is not correctly
formatted:
1/ add an eval around the second DateTime->new call, the subroutine will return
undef and the caller will have to check if something has been returned ;
2/ or catch the croak raised by the DateTime in the callers
I don't know what I would prefer (a bit early and not drank enough tea yet).
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list