summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-02-25 12:28:01 +0100
committermkanat%kerio.com <>2005-02-25 12:28:01 +0100
commit1414db6ba6c7508bf6e0e4c1191218aa71d7ce43 (patch)
tree671f0025ffcadcd94848b36982f49c3256021aab /Bugzilla
parent94c2df0e830ea7070436f8ade182645893ac3373 (diff)
downloadbugzilla-1414db6ba6c7508bf6e0e4c1191218aa71d7ce43.tar.gz
bugzilla-1414db6ba6c7508bf6e0e4c1191218aa71d7ce43.tar.xz
Bug 282748: uninitialized value in localtime in Format.pm
Patch By Frederic Buclin <LpSolit@gmail.com> r=wurblzap, a=myk
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/BugMail.pm8
-rw-r--r--Bugzilla/Util.pm15
2 files changed, 12 insertions, 11 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index df734ef6f..b4b0c9dfe 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -201,7 +201,9 @@ sub ProcessOneBug($) {
}
$values{'estimated_time'} = format_time_decimal($values{'estimated_time'});
- $values{'deadline'} = time2str("%Y-%m-%d", str2time($values{'deadline'}));
+ if ($values{'deadline'}) {
+ $values{'deadline'} = time2str("%Y-%m-%d", str2time($values{'deadline'}));
+ }
my @dependslist;
SendSQL("SELECT dependson FROM dependencies WHERE
@@ -262,10 +264,6 @@ sub ProcessOneBug($) {
WHERE attach_id = $attachid");
$diffpart->{'isprivate'} = FetchOneColumn();
}
- if( $fieldname eq 'deadline' ) {
- $old = time2str("%Y-%m-%d", str2time($old));
- $new = time2str("%Y-%m-%d", str2time($new));
- }
$difftext = FormatTriple($what, $old, $new);
$diffpart->{'header'} = $diffheader;
$diffpart->{'fieldname'} = $fieldname;
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index 3bc39ff09..7481c18c3 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -277,14 +277,17 @@ sub file_mod_time ($) {
sub ValidateDate {
my ($date, $format) = @_;
+ my $date2;
- my $ts = str2time($date);
- my $date2 = time2str("%Y-%m-%d", $ts);
+ # $ts is undefined if the parser fails.
+ my $ts = str2time($date);
+ if ($ts) {
+ $date2 = time2str("%Y-%m-%d", $ts);
- $date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
- $date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
-
- if ($date ne $date2) {
+ $date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
+ $date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
+ }
+ if (!$ts || $date ne $date2) {
ThrowUserError('illegal_date', {date => $date, format => $format});
}
}