Skip Menu |

This queue is for tickets about the TimeDate CPAN distribution.

Report information
The Basics
Id: 27133
Status: rejected
Priority: 0/
Queue: TimeDate

People
Owner: Nobody in particular
Requestors: bulldogorama [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: TimeDate-1.16 > Date::Parse
Date: Mon, 14 May 2007 14:58:55 -0700
To: bug-TimeDate [...] rt.cpan.org
From: Bulldog <bulldogorama [...] gmail.com>
Bad month range checking. str2time accepts invalid month dates, e.g. str2time('2/31/2007') returns '1172880000', but Feb 2007 only has 28 days. strptime is even worse, accepting invalid month dates up to 99, e.g. strptime('2/99/2007') returns (undef, undef, undef, 99, 1, 107, undef). No documentation of this issue in the perldocs for this module. ====== Distribution name and version: Date::Parse-2.09 on prod system. Tested with Date::Parse-2.27 and still had same issue. Perl version: v5.6.0 built for Linux-2.4c2.3-i686 Operating System vendor and version: Linux 2.4.21-37a13smp #1 SMP Thu Nov 16 05:41:08 PST 2006 i686 i686 i386 GNU/Linux Repro: === Code === require Date::Parse; print '2/31/2007 => ', Date::Parse::str2time('2/31/2007'), "\n"; print '2/99/2007 => ', join(',', Date::Parse::strptime('2/99/2007')), "\n"; === End Code === Produces the following (warnings omitted): ~~~ Output ~~~ 2/31/2007 => 1172880000 2/99/2007 => ,,,99,1,107, ~~~ End Output ~~~ Thanks. - David
Subject: Re: [rt.cpan.org #27133] TimeDate-1.16 > Date::Parse
Date: Tue, 15 May 2007 06:54:49 -0500
To: bug-TimeDate [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On May 14, 2007, at 4:59 PM, Bulldog via RT wrote: Show quoted text
> Bad month range checking. > > str2time accepts invalid month dates, e.g. str2time('2/31/2007') > returns '1172880000', but Feb 2007 only has 28 days.
I cannot reproduce this. perl -Ilib -MDate::Parse=str2time -wle 'print scalar str2time ("2/31/2007")' Use of uninitialized value in print at -e line 1. Do you have the latest Time::Local installed ? It is that module which does the conversion/checking. Date::Parse only attempts to extract data from the given string and pass it to Time::Local. Show quoted text
> strptime is even worse, accepting invalid month dates up to 99, e.g. > strptime('2/99/2007') returns (undef, undef, undef, 99, 1, 107, > undef).
That is possible, there is not checking that a valid date was passed in. Graham.
Subject: Re: [rt.cpan.org #27133] TimeDate-1.16 > Date::Parse
Date: Thu, 24 May 2007 12:24:10 -0700
To: bug-TimeDate [...] rt.cpan.org
From: Bulldog <bulldogorama [...] gmail.com>
Sorry about taking so long to get back. I'll check with our local perl gurus to see which version we have installed. I'll get back to you when I know more. Thanks. - David On 5/15/07, Graham Barr via RT <bug-TimeDate@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27133 > > > On May 14, 2007, at 4:59 PM, Bulldog via RT wrote:
> > Bad month range checking. > > > > str2time accepts invalid month dates, e.g. str2time('2/31/2007') > > returns '1172880000', but Feb 2007 only has 28 days.
> > I cannot reproduce this. > > perl -Ilib -MDate::Parse=str2time -wle 'print scalar str2time > ("2/31/2007")' > Use of uninitialized value in print at -e line 1. > > Do you have the latest Time::Local installed ? It is that module > which does > the conversion/checking. Date::Parse only attempts to extract data > from the given > string and pass it to Time::Local. >
> > strptime is even worse, accepting invalid month dates up to 99, e.g. > > strptime('2/99/2007') returns (undef, undef, undef, 99, 1, 107, > > undef).
> > That is possible, there is not checking that a valid date was passed in.
Subject: Re: [rt.cpan.org #27133] TimeDate-1.16 > Date::Parse
Date: Thu, 24 May 2007 16:04:04 -0700
To: bug-TimeDate [...] rt.cpan.org
From: Bulldog <bulldogorama [...] gmail.com>
Indeed, it looks like the underlying problem with str2time is Time::Local Show quoted text
>perl -MTime::Local -e 'print timelocal(0,0,0,31,1,2007)'
1172880000 I've contacted our perl gurus to see if they can take appropriate action. However, I wasn't able to do the same with the strptime input: Show quoted text
>perl -MTime::Local -MData::Dumper -e 'print timelocal(0,0,0,99,1,2007)'
Day '99' out of range 1..31 at -e line 1 So it might be a different problem. - David On 5/15/07, Graham Barr via RT <bug-TimeDate@rt.cpan.org> wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=27133 > > > On May 14, 2007, at 4:59 PM, Bulldog via RT wrote:
> > Bad month range checking. > > > > str2time accepts invalid month dates, e.g. str2time('2/31/2007') > > returns '1172880000', but Feb 2007 only has 28 days.
> > I cannot reproduce this. > > perl -Ilib -MDate::Parse=str2time -wle 'print scalar str2time > ("2/31/2007")' > Use of uninitialized value in print at -e line 1. > > Do you have the latest Time::Local installed ? It is that module > which does > the conversion/checking. Date::Parse only attempts to extract data > from the given > string and pass it to Time::Local. >
> > strptime is even worse, accepting invalid month dates up to 99, e.g. > > strptime('2/99/2007') returns (undef, undef, undef, 99, 1, 107, > > undef).
> > That is possible, there is not checking that a valid date was passed in.