fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-09-21 10:08 am

[dw-free] clean up log messages that appear when global warnings are on

[commit: http://hg.dwscoalition.org/dw-free/rev/2a333cd49a4b]

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

Better code practices to avoid warnings.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Logic/LogItems.pm
  • cgi-bin/DW/Logic/MenuNav.pm
  • cgi-bin/DW/Request/Base.pm
  • cgi-bin/DW/User/Edges/WatchTrust.pm
  • cgi-bin/DW/User/Edges/WatchTrust/Loader.pm
  • cgi-bin/LJ/CleanHTML.pm
  • cgi-bin/LJ/Entry.pm
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/RecentPage.pm
  • cgi-bin/LJ/S2/YearPage.pm
  • cgi-bin/LJ/Session.pm
  • cgi-bin/LJ/UniqCookie.pm
  • cgi-bin/LJ/Widget/Search.pm
  • cgi-bin/htmlcontrols.pl
  • cgi-bin/weblib.pl
  • htdocs/inbox/index.bml
--------------------------------------------------------------------------------
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/DW/Logic/LogItems.pm
--- a/cgi-bin/DW/Logic/LogItems.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/DW/Logic/LogItems.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -393,7 +393,7 @@ sub recent_items
     #   with 32 bit time_t structs dies)
     #
     # Unless we are not on a friends view, then want to use the actual end of time.
-    my $notafter = $args{notafter} + 0;
+    my $notafter = $args{notafter} ? $args{notafter} + 0 : 0;
     $notafter ||= $args{friendsview} ? $LJ::EndOfTime - 1 : $LJ::EndOfTime;
 
     my $skip = $args{'skip'}+0;
@@ -432,7 +432,7 @@ sub recent_items
     }
 
     # because LJ::get_friend_items needs rlogtime for sorting.
-    my $extra_sql;
+    my $extra_sql = '';
     if ($args{'friendsview'}) {
         $extra_sql .= "journalid AS 'ownerid', rlogtime, ";
     }
@@ -537,7 +537,8 @@ sub recent_items
     while (my $li = $sth->fetchrow_hashref) {
         push @{$args{'itemids'}}, $li->{'itemid'};
 
-        $flush->() if $li->{alldatepart} ne $last_time;
+        $flush->() unless defined $last_time &&
+                          $li->{alldatepart} eq $last_time;
         push @buf, $li;
         $last_time = $li->{alldatepart};
 
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/DW/Logic/MenuNav.pm
--- a/cgi-bin/DW/Logic/MenuNav.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/DW/Logic/MenuNav.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -41,7 +41,7 @@ sub get_menu_navigation {
 
     $u ||= LJ::get_remote();
 
-    my ( $userpic_count, $userpic_max, $inbox_count );
+    my ( $userpic_count, $userpic_max, $inbox_count ) = ( 0,0,0 );
     if ( $u ) {
         $userpic_count = $u->get_userpic_count;
         $userpic_max = $u->userpic_quota;
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/DW/Request/Base.pm
--- a/cgi-bin/DW/Request/Base.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/DW/Request/Base.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -90,7 +90,7 @@ sub parse {
     my %results;
     my %results_multi;
 
-    my @pairs = split( "[;,] ?", $_[1] );
+    my @pairs = split( "[;,] ?", defined $_[1] ? $_[1] : '' );
     foreach ( @pairs ) {
         $_ =~ s/\s*(.*?)\s*/$1/;
         my ( $key, $value ) = split( "=", $_, 2 );
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/DW/User/Edges/WatchTrust.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/DW/User/Edges/WatchTrust.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -452,7 +452,8 @@ sub trusted_by_userids {
 sub trusted_by_userids {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or confess 'not a valid user object';
-    my $limit = int(delete $args{limit}) || $LJ::MAX_WT_EDGES_LOAD;
+    my $limit = delete $args{limit} || 0;
+    $limit = int( $limit ) || $LJ::MAX_WT_EDGES_LOAD;
     confess 'unknown option' if %args;
 
     return DW::User::Edges::WatchTrust::Loader::_wt_userids(
@@ -466,7 +467,8 @@ sub trusted_userids {
 sub trusted_userids {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or confess 'not a valid user object';
-    my $limit = int(delete $args{limit}) || $LJ::MAX_WT_EDGES_LOAD;
+    my $limit = delete $args{limit} || 0;
+    $limit = int( $limit ) || $LJ::MAX_WT_EDGES_LOAD;
     confess 'unknown option' if %args;
 
     return DW::User::Edges::WatchTrust::Loader::_wt_userids(
@@ -480,7 +482,8 @@ sub watched_by_userids {
 sub watched_by_userids {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or confess 'not a valid user object';
-    my $limit = int(delete $args{limit}) || $LJ::MAX_WT_EDGES_LOAD;
+    my $limit = delete $args{limit} || 0;
+    $limit = int( $limit ) || $LJ::MAX_WT_EDGES_LOAD;
     confess 'unknown option' if %args;
 
     return DW::User::Edges::WatchTrust::Loader::_wt_userids(
@@ -494,7 +497,8 @@ sub watched_userids {
 sub watched_userids {
     my ( $u, %args ) = @_;
     $u = LJ::want_user( $u ) or confess 'not a valid user object';
-    my $limit = int(delete $args{limit}) || $LJ::MAX_WT_EDGES_LOAD;
+    my $limit = delete $args{limit} || 0;
+    $limit = int( $limit ) || $LJ::MAX_WT_EDGES_LOAD;
     confess 'unknown option' if %args;
 
     return DW::User::Edges::WatchTrust::Loader::_wt_userids(
@@ -702,7 +706,8 @@ sub trust_groups {
     my ( $u, %opts ) = @_;
     $u = LJ::want_user( $u )
         or confess 'invalid user object';
-    my $bit = delete( $opts{id} )+0;
+    my $id = delete $opts{id};
+    my $bit = defined $id ? $id + 0 : 0;
     confess 'invalid bit number' if $bit < 0 || $bit > 60;
     my $name = lc delete( $opts{name} );
     confess 'invalid arguments' if %opts;
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/DW/User/Edges/WatchTrust/Loader.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust/Loader.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/DW/User/Edges/WatchTrust/Loader.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -36,8 +36,9 @@ sub _trustmask {
 
         $mask = $dbr->selectrow_array(
             'SELECT groupmask FROM wt_edges WHERE from_userid = ? AND to_userid = ?',
-            undef, $from_userid, $to_userid ) + 0; # force numeric
+            undef, $from_userid, $to_userid );
         return 0 if $dbr->err;
+        $mask = $mask ? $mask + 0 : 0; # force numeric
 
         LJ::MemCache::set( $memkey, $mask, 3600 );
     }
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/CleanHTML.pm
--- a/cgi-bin/LJ/CleanHTML.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/CleanHTML.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -1011,7 +1011,7 @@ sub clean
             }
 
             my $auto_format = $addbreaks &&
-                ($opencount{'table'} <= ($opencount{'td'} + $opencount{'th'})) &&
+                ( ( $opencount{table} || 0 ) <= ( $opencount{td} + $opencount{th} ) ) &&
                  ! $opencount{'pre'} &&
                  ! $opencount{'lj-raw'};
 
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/Entry.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -1024,9 +1024,9 @@ sub group_names {
 }
 
 sub statusvis {
-    my $self = shift;
-
-    return $self->prop("statusvis") eq "S" ? "S" : "V";
+    my $self = $_[0];
+    my $vis = $self->prop("statusvis") || '';
+    return $vis eq "S" ? "S" : "V";
 }
 
 sub is_visible {
@@ -2206,7 +2206,7 @@ sub currents {
 
     my ( $key, $entry, $s2imgref );
     if ( $opts && ref $opts ) {
-        $key = $opts->{key};
+        $key = $opts->{key} || '';
         $entry = $opts->{entry};
         $s2imgref = $opts->{s2imgref};
     }
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/S2.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -563,7 +563,7 @@ sub get_layers_of_user
 
     foreach (keys %layers) {
         # setup uniq alias.
-        if ($layers{$_}->{'uniq'} ne "") {
+        if ( defined $layers{$_}->{uniq} && $layers{$_}->{uniq} ne "" ) {
             $layers{$layers{$_}->{'uniq'}} = $layers{$_};
         }
 
@@ -856,7 +856,7 @@ sub escape_prop_value {
             my $clean = $css_c->clean_property($_[0]);
             $_[0] = $clean;
         }
-        else { # plain
+        elsif ( defined $_[0] ) { # plain
             $_[0] =~ s/</&lt;/g;
             $_[0] =~ s/>/&gt;/g;
             $_[0] =~ s!\n!<br />!g;
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/S2/RecentPage.pm
--- a/cgi-bin/LJ/S2/RecentPage.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/S2/RecentPage.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -103,7 +103,7 @@ sub RecentPage
     if ($itemshow < 1) { $itemshow = 20; }
     elsif ($itemshow > 50) { $itemshow = 50; }
 
-    my $skip = $get->{'skip'}+0;
+    my $skip = $get->{skip} ? $get->{skip} + 0 : 0;
     my $maxskip = $LJ::MAX_SCROLLBACK_LASTN-$itemshow;
     if ($skip < 0) { $skip = 0; }
     if ($skip > $maxskip) { $skip = $maxskip; }
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/S2/YearPage.pm
--- a/cgi-bin/LJ/S2/YearPage.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/S2/YearPage.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -148,7 +148,7 @@ sub YearMonth {
         while (my $im = each %$h) {
             next if $im >= $month;
             my $val = $iy * 12 + $im;
-            if ($val < $nowval && $val > $maxbefore) {
+            if ( $val < $nowval && ( !$maxbefore || $val > $maxbefore ) ) {
                 $maxbefore = $val;
                 $calmon->{'prev_url'} = $p->{'_u'}->{'_journalbase'} . sprintf("/%04d/%02d/", $iy, $im);
                 $calmon->{'prev_date'} = Date($iy, $im, 0);
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/Session.pm
--- a/cgi-bin/LJ/Session.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/Session.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -406,7 +406,8 @@ sub helper_url {
 
     if ($dest =~ m!^(https?://)([^/]*?)\.\Q$LJ::USER_DOMAIN\E/?([^/]*)!) {
         my $url = "$1$2.$LJ::USER_DOMAIN/";
-        if ($LJ::SUBDOMAIN_FUNCTION{lc($2)} eq "journal") {
+        if ( $LJ::SUBDOMAIN_FUNCTION{ lc($2) } &&
+             $LJ::SUBDOMAIN_FUNCTION{ lc($2) } eq "journal" ) {
             $url .= "$3/" if $3 && ($3 ne '/'); # 'http://community.livejournal.com/name/__setdomsess'
         }
 
@@ -456,10 +457,11 @@ sub domain_journal {
     return undef if $host eq lc($LJ::DOMAIN_WEB) || $host eq lc($LJ::DOMAIN);
 
     return undef unless
-        $host =~ m!^([\w-\.]{1,50})\.\Q$LJ::USER_DOMAIN\E$!;
+        $host =~ m!^([-\w\.]{1,50})\.\Q$LJ::USER_DOMAIN\E$!;
 
     my $subdomain = lc($1);
-    if ($LJ::SUBDOMAIN_FUNCTION{$subdomain} eq "journal") {
+    if ( $LJ::SUBDOMAIN_FUNCTION{$subdomain} &&
+         $LJ::SUBDOMAIN_FUNCTION{$subdomain} eq "journal" ) {
         return undef unless $path =~ m!^/(\w{1,15})\b!;
         my $user = lc($1);
         return wantarray ? ($subdomain, $user) : $user;
@@ -595,7 +597,7 @@ sub session_from_master_cookie {
         }
 
         # must do this first so they can't trick us
-        $$tried_fast = 1 if $flags =~ /\.FS\b/;
+        $$tried_fast = 1 if $flags && $flags =~ /\.FS\b/;
 
         next COOKIE if $bogus;
 
@@ -741,8 +743,9 @@ sub setdomsess_handler {
         my ($host, $url_path) = (lc($1), $2);
         my ($subdomain, $user);
 
-        if (    $host =~ m!^([\w-\.]{1,50})\.\Q$LJ::USER_DOMAIN\E$!
+        if (    $host =~ m!^([-\w\.]{1,50})\.\Q$LJ::USER_DOMAIN\E$!
             && ($subdomain = lc($1))                                # undef: not on a user-subdomain
+            &&  $LJ::SUBDOMAIN_FUNCTION{$subdomain}
             && ($LJ::SUBDOMAIN_FUNCTION{$subdomain} eq "journal")
             && ($url_path =~ m!^/(\w{1,15})\b!) ) {
                 $path = '/' . lc($1) . '/' if $1;
@@ -843,8 +846,9 @@ sub set_cookie {
     );
 
     # Backwards compatability for older browsers
+    return unless defined $domain;
     my @labels = split(/\./, $domain);
-    if ($domain && scalar @labels == 2 && ! $LJ::DEBUG{no_extra_dot_cookie}) {
+    if ( scalar @labels == 2 && ! $LJ::DEBUG{no_extra_dot_cookie} ) {
         $r->add_cookie(
             name     => $key,
             value    => $value,
@@ -926,13 +930,14 @@ sub valid_domain_cookie {
 
 sub valid_destination {
     my $dest = shift;
-    return $dest =~ qr!^http://[\w\-\.]+\.\Q$LJ::USER_DOMAIN\E/.*!;
+    return $dest =~ qr!^http://[-\w\.]+\.\Q$LJ::USER_DOMAIN\E/!;
 }
 
 sub valid_cookie_generation {
-    my $gen    = shift;
+    my $gen    = shift || '';
     my $dgen   = LJ::durl($gen);
     foreach my $okay ($LJ::COOKIE_GEN, @LJ::COOKIE_GEN_OKAY) {
+        $okay = '' unless defined $okay;
         return 1 if $gen  eq $okay;
         return 1 if $dgen eq $okay;
     }
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/UniqCookie.pm
--- a/cgi-bin/LJ/UniqCookie.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/UniqCookie.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -478,10 +478,9 @@ sub parts_from_cookie {
 
 # returns: (uniq_val, uniq_time, uniq_extra)
 sub parts_from_value {
-    my $class = shift;
-    my $value = shift;
+    my ( $class, $value ) = @_;
 
-    if ($value =~ /^([a-zA-Z0-9]{15}):(\d+)(.+)$/) {
+    if ( $value && $value =~ /^([a-zA-Z0-9]{15}):(\d+)(.+)$/ ) {
         return wantarray() ? ($1, $2, $3) : $1;
     }
 
@@ -489,15 +488,14 @@ sub parts_from_value {
 }
 
 sub set_current_uniq {
-    my $class = shift;
-    my $uniq = shift;
+    my ( $class, $uniq ) = @_;
 
     $LJ::REQ_CACHE{current_uniq} = $uniq;
 
     return unless LJ::is_web_context();
 
     my $r = BML::get_request();
-    $r->notes->{uniq} = $uniq;
+    $r->notes->{uniq} = $uniq if $r;
 
     return;
 }
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/LJ/Widget/Search.pm
--- a/cgi-bin/LJ/Widget/Search.pm	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/LJ/Widget/Search.pm	Tue Sep 21 18:08:28 2010 +0800
@@ -36,7 +36,7 @@ sub render_body {
         im => $class->ml( 'widget.search.iminfo' ),
     );
 
-    if ( $single_search eq "interest" ) {
+    if ( $single_search && $single_search eq "interest" ) {
         $ret .= "<p class='search-interestonly'>" . $class->ml( 'widget.search.interestonly' ) . "</p>";
         $select_box = LJ::html_hidden( type => "int" );
         $search_btn = LJ::html_submit( $class->ml( 'widget.search.interestonly.btn' ) );
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/htmlcontrols.pl
--- a/cgi-bin/htmlcontrols.pl	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/htmlcontrols.pl	Tue Sep 21 18:08:28 2010 +0800
@@ -204,14 +204,14 @@ sub _html_option {
 
     my $sel = "";
     # multiple-mode or single-mode?
-    if ( ref $selref eq 'HASH' && $selref->{$value} ||
-        $opts->{selected} eq $value && ! $$did_sel++ ) {
+    if ( $selref && ( ref $selref eq 'HASH' ) && $selref->{$value} ||
+        $opts->{selected} && ( $opts->{selected} eq $value ) && ! $$did_sel++ ) {
 
         $sel = " selected='selected'";
     }
     $value  = $ehtml ? ehtml( $value ) : $value;
 
-    my $id;
+    my $id = '';
     if ( $opts->{include_ids} && $opts->{name} ne "" && $value ne "" ) {
         $id = " id='$opts->{'name'}_$value'";
     }
@@ -247,7 +247,7 @@ sub html_check
     my $disabled = $opts->{'disabled'} ? " disabled='disabled'" : "";
     my $ehtml = $opts->{'noescape'} ? 0 : 1;
     my $ret;
-    if ($opts->{'type'} eq "radio") {
+    if ( $opts->{type} && $opts->{type} eq "radio" ) {
         $ret .= "<input type='radio'";
     } else {
         $ret .= "<input type='checkbox'";
@@ -268,6 +268,8 @@ sub html_check
 # in a label, respecting HTML
 sub labelfy {
     my ($id, $text) = @_;
+    $id = '' unless defined $id;
+    $text = '' unless defined $text;
 
     $text =~ s!
         ^([^<]+)
@@ -295,11 +297,15 @@ sub html_text
 
     my $disabled = $opts->{'disabled'} ? " disabled='disabled'" : "";
     my $ehtml = $opts->{'noescape'} ? 0 : 1;
-    my $type = $opts->{'type'} eq 'password' || $opts->{'type'} eq 'search' ? $opts->{'type'} : 'text';
-    my $ret;
+    my $type = 'text';
+    $type = $opts->{type} if $opts->{type} &&
+                             ( $opts->{type} eq 'password' ||
+                               $opts->{type} eq 'search' );
+    my $ret = '';
     $ret .= "<input type=\"$type\"";
     foreach (grep { ! /^(type|disabled|raw|noescape)$/ } keys %$opts) {
-        $ret .= " $_=\"" . ($ehtml ? ehtml($opts->{$_}) : $opts->{$_}) . "\"";
+        my $val = $opts->{$_} || '';
+        $ret .= " $_=\"" . ( $ehtml ? LJ::ehtml( $val ) : $val ) . "\"";
     }
     if ($opts->{'raw'}) { $ret .= " $opts->{'raw'}"; }
     $ret .= "$disabled />";
@@ -412,7 +418,7 @@ sub html_hidden
         my $name = shift;
         my $val;
         my $ehtml = 1;
-        my $extra;
+        my $extra = '';
         if (ref $name eq 'HASH') {
             my $opts = $name;
 
@@ -466,14 +472,14 @@ sub html_submit
         $name = undef;
     }
 
-    my ($eopts, $disabled, $raw);
+    my ( $eopts, $disabled, $raw ) = ( '','','' );
     my $type = 'submit';
 
     my $ehtml;
     if ($opts && ref $opts eq 'HASH') {
         $disabled = " disabled='disabled'" if $opts->{'disabled'};
         $raw = " $opts->{'raw'}" if $opts->{'raw'};
-        $type = 'reset' if $opts->{'type'} eq 'reset';
+        $type = 'reset' if $opts->{type} && $opts->{type} eq 'reset';
 
         $ehtml = $opts->{'noescape'} ? 0 : 1;
         foreach (grep { ! /^(raw|disabled|noescape|type)$/ } keys %$opts) {
diff -r 1bb4e26a52fd -r 2a333cd49a4b cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Tue Sep 21 17:18:11 2010 +0800
+++ b/cgi-bin/weblib.pl	Tue Sep 21 18:08:28 2010 +0800
@@ -962,7 +962,9 @@ sub viewing_style_opts {
     $ret{s2id} = $args{s2id} if $args{s2id} && $args{s2id} =~ /^\d+$/;
 
     for my $key( qw ( format style ) ) {
-        $ret{$key} = $args{$key} if $valid_style_args->{$key}->{$args{$key}};
+        $ret{$key} = $args{$key}
+            if $valid_style_args->{$key} &&
+               $valid_style_args->{$key}->{$args{$key}};
     }
 
     return \%ret;
@@ -1855,11 +1857,10 @@ PREVIEW
 
 # entry form subject
 sub entry_form_subject_widget {
-    my $class = shift;
+    my $class = $_[0];
 
-    if ($class) {
-        $class = qq { class="$class" };
-    }
+    $class = $class ? qq { class="$class" } : '';
+
     return qq { <input name="subject" id="subject" $class/> };
 }
 
@@ -1879,11 +1880,9 @@ sub entry_form_date_widget {
 
 # entry form event text box
 sub entry_form_entry_widget {
-    my $class = shift;
+    my $class = $_[0];
 
-    if ($class) {
-        $class = qq { class="$class" };
-    }
+    $class = $class ? qq { class="$class" } : '';
 
     return qq { <textarea cols=50 rows=10 name="event" id="event" $class></textarea> };
 }
@@ -2173,6 +2172,7 @@ sub js_dumper {
         my $ret = "[" . join(", ", map { js_dumper($_) } @$obj) . "]";
         return $ret;
     } else {
+        $obj = '' unless defined $obj;
         return $obj if $obj =~ /^\d+$/;
         return "\"" . LJ::ejs($obj) . "\"";
     }
@@ -2332,7 +2332,7 @@ sub res_includes {
         $what .= "?v=$modtime" unless $do_concat;
 
         push @{$list{$type} ||= []}, $what;
-        $oldest{$type} = $modtime if $modtime > $oldest{$type};
+        $oldest{$type} = $modtime if $modtime > ( $oldest{$type} || 0 );
     };
 
     foreach my $by_priority ( reverse @LJ::NEEDED_RES ) {
@@ -2468,9 +2468,8 @@ sub control_strip
     my $args = $baseuri ? delete $opts{args} : $r->query_string; # use passed in args if we have a passed in location
     my $view = delete $opts{view} || $r->note( 'view' );
 
-    my $querysep = $args ? "?" : "";
     my $uri = $baseuri ? "http://$baseuri" : "http://" . $r->header_in('Host') . $r->uri;
-    $uri .= "$querysep$args";
+    $uri .= $args ? "?$args" : "";
     my $euri = LJ::eurl($uri);
     my $create_link = LJ::Hooks::run_hook("override_create_link_on_navstrip", $journal) || "<a href='$LJ::SITEROOT/create'>" . BML::ml('web.controlstrip.links.create', {'sitename' => $LJ::SITENAMESHORT}) . "</a>";
 
@@ -2771,7 +2770,7 @@ sub control_strip
             $ret .= "&nbsp;";
         }
 
-        $ret .= LJ::Hooks::run_hook('control_strip_logo', $remote, $journal);
+        $ret .= LJ::Hooks::run_hook('control_strip_logo', $remote, $journal) || '';
         $ret .= "</td>";
 
     } else {
@@ -2887,7 +2886,7 @@ sub control_strip_js_inject
 sub control_strip_js_inject
 {
     my %opts = @_;
-    my $user = delete $opts{user};
+    my $user = delete $opts{user} || '';
 
     my $ret;
 
@@ -2903,8 +2902,8 @@ sub control_strip_js_inject
 
     my $r = DW::Request->get;
     my $baseuri = $r->header_in( 'Host' ) . $r->uri;
-    my $args = LJ::eurl( $r->query_string );
-    my $view = $r->note( 'view' );
+    my $args = LJ::eurl( $r->query_string ) || '';
+    my $view = $r->note( 'view' ) || '';
 
     $ret .= qq{
 <script type='text/javascript'>
diff -r 1bb4e26a52fd -r 2a333cd49a4b htdocs/inbox/index.bml
--- a/htdocs/inbox/index.bml	Tue Sep 21 17:18:11 2010 +0800
+++ b/htdocs/inbox/index.bml	Tue Sep 21 18:08:28 2010 +0800
@@ -169,7 +169,7 @@ body<=
     $body .= LJ::error_list( $@ ) if $@;
 
     # Pagination
-    my $page = int($POST{page} || $GET{page});
+    $page = int($POST{page} || $GET{page});
     
     $body .= LJ::Widget::InboxFolder->render(
                      folder  => "all",
--------------------------------------------------------------------------------

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