Permalink
Browse files

fixed Mojo::Date to not crash on invalid dates

  • Loading branch information...
1 parent 301912a commit 796eb0b3167eb77e32401b0a0aaf6d66a0d44ad4 Sebastian Riedel committed Mar 16, 2009
Showing with 3 additions and 1 deletion.
  1. +1 −0 Changes
  2. +1 −0 lib/Mojo/Date.pm
  3. +1 −1 t/mojo/date.t
View
@@ -10,6 +10,7 @@ This file documents the revision history for Perl extension Mojo.
routes internals.
- Added Makefile.PL generator.
- Support more CGI implementations.
+ - Fixed Mojo::Date to not crash on invalid dates. (vti)
- Fixed tokenizer in MojoX::Routes::Pattern to support "0" values.
(Anatoly Sharifulin)
- Fixed parsing of "0" in Mojo::Path. (charsbar)
View
@@ -85,6 +85,7 @@ sub parse {
my $epoch;
+ # Prevent crash
eval {
$epoch =
Time::Local::timegm($second, $minute, $hour, $day, $month, $year);
View
@@ -30,6 +30,6 @@ is($date->epoch, 0);
is("$date", 'Thu, 01 Jan 1970 00:00:00 GMT');
is($date->parse('Thu, 01 Jan 1970 00:00:00 GMT')->epoch, 0);
-# Wrong time checks
+# Bad time checks
ok(not defined $date->parse('Mon, 01 Jan 1900 00:00:00'));
is($date->epoch, 0);

0 comments on commit 796eb0b

Please sign in to comment.