From 142986ced3d7d595a83b0b2d04ec86d7a2928906 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... Content-Type: text/plain; charset="utf-8" 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. --- admin/systempreferences.pl | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 175f6a0..41130b2 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -420,6 +420,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 ); @@ -452,6 +453,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 ); -- 1.7.2.5