From c8c80a8e787ff04cf167dbeae7602a484e22f977 Mon Sep 17 00:00:00 2001 From: Marc Veron Date: Wed, 10 Oct 2012 07:49:36 +0200 Subject: [PATCH] Bug 8895 - Warning in systempreferences.pl: Use of uninitialized value in length... Clicking on Local use tab in system preferences results in warning in log file: systempreferences.pl: Use of uninitialized value in length at (...)/admin/systempreferences.pl line 456 Reason: content field "value" in table "systempreferences" can be NULL (and is tested for length). Added test for "defined" at to places. Signed-off-by: Kyle M Hall Signed-off-by: Chris Cormack --- admin/systempreferences.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 5e3848d623..835466a16c 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -428,6 +428,7 @@ sub StringSearch { my $sth = $dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable"); $sth->execute($syspref); while ( my $data = $sth->fetchrow_hashref ) { + unless (defined $data->{value}) { $data->{value} = "";} $data->{shortvalue} = $data->{value}; $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if defined( $data->{value} ) and length( $data->{value} ) > 60; push( @results, $data ); @@ -460,6 +461,7 @@ sub StringSearch { } while ( my $data = $sth->fetchrow_hashref ) { + unless (defined $data->{value}) { $data->{value} = "";} $data->{shortvalue} = $data->{value}; $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if length( $data->{value} ) > 60; push( @results, $data ); -- 2.39.5