Item14741: EVAL(0) should return 0 not the empty string
Priority: Normal
Current State: Closed
Released In: 2.1.7
Target Release: patch
Test:
%CALCULATE{"Foo$EVAL(0)Bar"}% = Foo0Bar .... should be Foo0Bar
Hotfix:
diff --git a/SpreadSheetPlugin/lib/Foswiki/Plugins/SpreadSheetPlugin/Calc.pm b/SpreadSheetPlugin/lib/Foswiki/Plugins/SpreadSheetPlugin/Calc.pm
index 7de7517c3..70309b5f1 100644
--- a/SpreadSheetPlugin/lib/Foswiki/Plugins/SpreadSheetPlugin/Calc.pm
+++ b/SpreadSheetPlugin/lib/Foswiki/Plugins/SpreadSheetPlugin/Calc.pm
@@ -1734,7 +1734,7 @@ sub _safeEvalPerl {
s/(^|[^0-9])e/$1/g; # remove "e"-s unless in expression such as "123e-4"
$theText =~ /(.*)/;
$theText = $1; # untainted variable
- return "" unless ($theText);
+ return "" unless defined ($theText);
local $SIG{__DIE__} =
sub { Foswiki::Func::writeDebug( $_[0] ); warn $_[0] };
my $result = eval $theText;
--
MichaelDaum - 19 Jul 2018