More grab-bag of cleanup for warnings.
Patch by kareila.
diffs (125 lines):
diff -r b1f45a6d5be9 -r 20a54f707bd3 cgi-bin/LJ/Widget.pm
--- a/cgi-bin/LJ/Widget.pm Wed Oct 27 12:45:17 2010 +0800
+++ b/cgi-bin/LJ/Widget.pm Wed Oct 27 13:06:08 2010 +0800
@@ -331,6 +331,7 @@ sub is_disabled {
my $class = shift;
my $subclass = $class->subclass;
+ return 0 unless $subclass;
return $LJ::WIDGET_DISABLED{$subclass} ? 1 : 0;
}
diff -r b1f45a6d5be9 -r 20a54f707bd3 cgi-bin/LJ/Widget/Location.pm
--- a/cgi-bin/LJ/Widget/Location.pm Wed Oct 27 12:45:17 2010 +0800
+++ b/cgi-bin/LJ/Widget/Location.pm Wed Oct 27 13:06:08 2010 +0800
@@ -217,7 +217,8 @@ sub handle_post {
return if $class->error_list;
- $post->{'timezone'} = "" unless grep { $post->{'timezone'} eq $_ }
DateTime::TimeZone::all_names();
+ $post->{timezone} = "" unless $post->{timezone} &&
+ grep { $post->{timezone} eq $_ } DateTime::TimeZone::all_names();
# check if specified country has states
if ($regions_cfg) {
diff -r b1f45a6d5be9 -r 20a54f707bd3 cgi-bin/htmlcontrols.pl
--- a/cgi-bin/htmlcontrols.pl Wed Oct 27 12:45:17 2010 +0800
+++ b/cgi-bin/htmlcontrols.pl Wed Oct 27 13:06:08 2010 +0800
@@ -122,14 +122,14 @@ sub html_datetime_decode
{
my $opts = shift;
my $hash = shift;
- my $name = $opts->{'name'};
+ my $name = $opts->{name} || '';
return sprintf("%04d-%02d-%02d %02d:%02d:%02d",
- $hash->{"${name}_yyyy"},
- $hash->{"${name}_mm"},
- $hash->{"${name}_dd"},
- $hash->{"${name}_hh"},
- $hash->{"${name}_nn"},
- $hash->{"${name}_ss"});
+ $hash->{"${name}_yyyy"} || 0,
+ $hash->{"${name}_mm"} || 0,
+ $hash->{"${name}_dd"} || 0,
+ $hash->{"${name}_hh"} || 0,
+ $hash->{"${name}_nn"} || 0,
+ $hash->{"${name}_ss"} || 0 );
}
# <LJFUNC>
diff -r b1f45a6d5be9 -r 20a54f707bd3 cgi-bin/ljtimeutil.pl
--- a/cgi-bin/ljtimeutil.pl Wed Oct 27 12:45:17 2010 +0800
+++ b/cgi-bin/ljtimeutil.pl Wed Oct 27 13:06:08 2010 +0800
@@ -72,6 +72,12 @@ sub mysqldate_to_time {
my ($string, $gmt) = @_;
return undef unless $string =~ /^(\d\d\d\d)-(\d\d)-(\d\d)(?:
(\d\d):(\d\d)(?::(\d\d))?)?$/;
my ($y, $mon, $d, $h, $min, $s) = ($1, $2, $3, $4, $5, $6);
+
+ # these need to be set to zero if undefined, to avoid warnings
+ $h ||= 0;
+ $min ||= 0;
+ $s ||= 0;
+
my $calc = sub {
$gmt ?
Time::Local::timegm($s, $min, $h, $d, $mon-1, $y) :
diff -r b1f45a6d5be9 -r 20a54f707bd3 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Wed Oct 27 12:45:17 2010 +0800
+++ b/cgi-bin/weblib.pl Wed Oct 27 13:06:08 2010 +0800
@@ -129,7 +129,9 @@ sub auto_linkify
return "<a href='$str'>$str</a>";
}
};
- $str =~ s!https?://[^\s\'\"\<\>]+[a-zA-Z0-9_/&=\-]! $match->($&); !ge;
+ $str =~ s!https?://[^\s\'\"\<\>]+[a-zA-Z0-9_/&=\-]! $match->($&); !ge
+ if defined $str;
+
return $str;
}
@@ -1384,8 +1386,8 @@ MOODS
};
my $comment_settings_journaldefault = sub {
- return "Disabled" if $opts->{'prop_opt_default_nocomments'} eq
'N';
- return "No Email" if $opts->{'prop_opt_default_noemail'} eq
'N';
+ return "Disabled" if $opts->{prop_opt_default_nocomments} &&
$opts->{prop_opt_default_nocomments} eq 'N';
+ return "No Email" if $opts->{prop_opt_default_noemail} &&
$opts->{prop_opt_default_noemail} eq 'N';
return "Enabled";
};
@@ -1418,10 +1420,12 @@ MOODS
# Comment Screening settings
$out .= "<span class='inputgroup-right'>\n";
$out .= "<label for='prop_opt_screening' class='left options'>" .
BML::ml('entryform.comment.screening2') . "</label>\n";
- my $screening_levels_default =
$opts->{'prop_opt_default_screening'} eq 'N' ? BML::ml('label.screening.none2')
:
- $opts->{'prop_opt_default_screening'} eq 'R' ?
BML::ml('label.screening.anonymous2') :
- $opts->{'prop_opt_default_screening'} eq 'F' ?
BML::ml('label.screening.nonfriends2') :
- $opts->{'prop_opt_default_screening'} eq 'A' ?
BML::ml('label.screening.all2') : BML::ml('label.screening.none2');
+ my $opt_default_screen = $opts->{prop_opt_default_screening} || '';
+ my $screening_levels_default =
+ $opt_default_screen eq 'N' ?
BML::ml('label.screening.none2') :
+ $opt_default_screen eq 'R' ?
BML::ml('label.screening.anonymous2') :
+ $opt_default_screen eq 'F' ?
BML::ml('label.screening.nonfriends2') :
+ $opt_default_screen eq 'A' ?
BML::ml('label.screening.all2') : BML::ml('label.screening.none2');
my @levels = ('', BML::ml('label.screening.default4',
{'aopts'=>$screening_levels_default}), 'N', BML::ml('label.screening.none2'),
'R', BML::ml('label.screening.anonymous2'), 'F',
BML::ml('label.screening.nonfriends2'),
'A', BML::ml('label.screening.all2'));
@@ -2075,13 +2079,13 @@ sub entry_form_decode
}
$req->{"prop_opt_preformatted"} ||= $POST->{'switched_rte_on'} ? 1 :
- $POST->{'event_format'} eq "preformatted" ? 1 : 0;
- $req->{"prop_opt_nocomments"} ||= $POST->{'comment_settings'} eq
"nocomments" ? 1 : 0;
- $req->{"prop_opt_noemail"} ||= $POST->{'comment_settings'} eq
"noemail" ? 1 : 0;
+ $POST->{event_format} && $POST->{event_format} eq "preformatted" ? 1 :
0;
+ $req->{"prop_opt_nocomments"} ||= $POST->{comment_settings} &&
$POST->{comment_settings} eq "nocomments" ? 1 : 0;
+ $req->{"prop_opt_noemail"} ||= $POST->{comment_settings} &&
$POST->{comment_settings} eq "noemail" ? 1 : 0;
$req->{'prop_opt_backdated'} = $POST->{'prop_opt_backdated'} ? 1 : 0;
if ( LJ::is_enabled( 'adult_content' ) ) {
- $req->{prop_adult_content} = $POST->{prop_adult_content};
+ $req->{prop_adult_content} = $POST->{prop_adult_content} || '';
$req->{prop_adult_content} = ""
unless $req->{prop_adult_content} eq "none" ||
$req->{prop_adult_content} eq "concepts" || $req->{prop_adult_content} eq
"explicit";
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog