Item11363: "Use of uninitialized value in substitution iterator" warning
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
"NULL" is a perfectly valid value for a database field, in fact it is often seen as the preferred database representation for the empty string.
However, NULL is represented as an
undef
value by DBI, which results in a warning when used in a substitution or other string interpolation. This is easily guarded against by the following patch:
--- a/lib/Foswiki/Plugins/DatabasePlugin/DATABASE_SQL.pm
+++ b/lib/Foswiki/Plugins/DatabasePlugin/DATABASE_SQL.pm
@@ -22,6 +22,7 @@ sub handle {
# reverse sort so we handle longer keys first
foreach my $k ( reverse sort keys %$res ) {
+ $res->{$k} = '' unless defined $res->{$k};
$row =~ s/\$$k/$res->{$k}/g;
}
$result .= $row . $separator;
--
FlorianSchlichting - 16 Dec 2011