From 4328b8784195aafe0d340d07d2d10b37d14540e0 Mon Sep 17 00:00:00 2001 From: "J. David Bavousett" Date: Thu, 10 Sep 2009 11:10:50 -0400 Subject: [PATCH] Handle null-or-empty to Charset::StripNonXmlChars When rebuild_zebra.pl is run from cron, there is an occasional error of the form: Use of uninitialized value $str in substitution (s///) at /home/ebpl/kohaclone/C4/Charset.pm line 304. This error is occuring when the string that is fed to Charset::StripNonXmlChars is null or undefined, for some reason. This fix will handle the null-or-empty condition, and thus suppress the error. Signed-off-by: Galen Charlton --- C4/Charset.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/Charset.pm b/C4/Charset.pm index 001cf01001..73572594d7 100644 --- a/C4/Charset.pm +++ b/C4/Charset.pm @@ -283,6 +283,9 @@ to work, at the possible risk of some data loss. sub StripNonXmlChars { my $str = shift; + if (!defined($str) || $str eq ""){ + return ""; + } $str =~ s/[^\x09\x0A\x0D\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]//g; return $str; } -- 2.39.5