]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 476889: importxml.pl crashes when importing bugs (Date::Parse::strptime() leave...
authorlpsolit%gmail.com <>
Thu, 5 Feb 2009 18:37:16 +0000 (18:37 +0000)
committerlpsolit%gmail.com <>
Thu, 5 Feb 2009 18:37:16 +0000 (18:37 +0000)
Bugzilla/Util.pm
importxml.pl

index 951c4df3c841adea39f974e0ece902e69f229c71..3573ad1480c798e80667973c0f35a91e78b773a1 100644 (file)
@@ -444,6 +444,9 @@ sub format_time {
     my @time = strptime($date);
 
     if (scalar @time) {
+        # Fix a bug in strptime() where seconds can be undefined in some cases.
+        $time[0] ||= 0;
+
         # strptime() counts years from 1900, and months from 0 (January).
         # We have to fix both values.
         my $dt = DateTime->new({year   => 1900 + $time[5],
index fd8c27723de135d9bac13eb925907bdaf03ace27..08bf06c93cc5aa27b21850b3f3373a8c771d66d2 100755 (executable)
@@ -567,7 +567,7 @@ sub process_bug {
     my $comments;
 
     $comments .= "\n\n--- Bug imported by $exporter_login ";
-    $comments .= format_time(localtime(time()), '%Y-%m-%d %H:%M %Z') . " ";
+    $comments .= format_time(scalar localtime(time()), '%Y-%m-%d %R %Z') . " ";
     $comments .= " ---\n\n";
     $comments .= "This bug was previously known as _bug_ $bug_fields{'bug_id'} at ";
     $comments .= $urlbase . "show_bug.cgi?id=" . $bug_fields{'bug_id'} . "\n";