fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-12-28 12:49 pm

[dw-free] hush warnings when loading S2 entry preview

[commit: http://hg.dwscoalition.org/dw-free/rev/5df591a35dac]

http://bugs.dwscoalition.org/show_bug.cgi?id=3350

Hush warnings.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/S2.pm
  • htdocs/preview/entry.bml
--------------------------------------------------------------------------------
diff -r 0a3ff6232c78 -r 5df591a35dac cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Tue Dec 28 19:40:54 2010 +0800
+++ b/cgi-bin/LJ/S2.pm	Tue Dec 28 20:49:07 2010 +0800
@@ -1773,14 +1773,17 @@ sub DateTime_tz
 
 sub DateTime_parts
 {
-    my @parts = split(/\s+/, shift);
+    my $datestr = defined $_[0] ? $_[0] : '';
+    my @parts = split /\s+/, $datestr;
+
     my $dt = { '_type' => 'DateTime' };
-    $dt->{'year'} = $parts[0]+0;
-    $dt->{'month'} = $parts[1]+0;
-    $dt->{'day'} = $parts[2]+0;
-    $dt->{'hour'} = $parts[3]+0;
-    $dt->{'min'} = $parts[4]+0;
-    $dt->{'sec'} = $parts[5]+0;
+    $dt->{year}  = defined $parts[0] ? $parts[0] + 0 : 0;
+    $dt->{month} = defined $parts[1] ? $parts[1] + 0 : 0;
+    $dt->{day}   = defined $parts[2] ? $parts[2] + 0 : 0;
+    $dt->{hour}  = defined $parts[3] ? $parts[3] + 0 : 0;
+    $dt->{min}   = defined $parts[4] ? $parts[4] + 0 : 0;
+    $dt->{sec}   = defined $parts[5] ? $parts[5] + 0 : 0;
+
     # the parts string comes from MySQL which has range 0-6,
     # but internally and to S2 we use 1-7.
     $dt->{'_dayofweek'} = $parts[6] + 1 if defined $parts[6];
diff -r 0a3ff6232c78 -r 5df591a35dac htdocs/preview/entry.bml
--- a/htdocs/preview/entry.bml	Tue Dec 28 19:40:54 2010 +0800
+++ b/htdocs/preview/entry.bml	Tue Dec 28 20:49:07 2010 +0800
@@ -308,8 +308,6 @@ _c?>
 
         $p->{'entry'} = $s2entry;
 
-        my $userlite_journal = LJ::S2::UserLite($u);
-
         $p->{'comments'} = [];
 
         $p->{'viewing_thread'} = 0;
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org