Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 41001
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: lecar_red [...] yahoo.com
Cc:
AdminCc:

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



Subject: Date_Cmp doesn't verify input parameters
Date_Cmp does not check the return values coming back from ParseDateString . In cases where both input strings are invalid strange results are returned. e.g. Date_Cmp( '1', '2' ) returns '0' or Date_Cmp( '', '' ) returns '0' (which kind of makes sense) I think the best approach for this would be to check the return value of both ParseDateString calls. here is my proposed patch: sub Date_Cmp { my($D1,$D2)=@_; my($date1)=ParseDateString($D1) || croak "Invalid input: date1"; my($date2)=ParseDateString($D2) || croak "Invalid input: date2"; return $date1 cmp $date2; } the problem might be backwards compatibility... Could add a flag to enabled croaking or preserve old behavior.
This is resolved in Date::Manip 6.xx