Skip to content

Commit 34f7966

Browse files
committed
Fix Google Chart's eval bug when column formatValue is a Math formula string
1 parent 31a18dc commit 34f7966

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/widgets/google/Chart.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,9 @@ protected function formatValue($value, $format, $row = null)
304304
$formatValue = Util::get($format, "formatValue", null);
305305

306306
if (is_string($formatValue)) {
307-
eval('$fv="' . str_replace('@value', '$value', $formatValue) . '";');
308-
return $fv;
307+
$fv = $formatValue;
308+
eval('$fv=' . str_replace('@value', '$value', $formatValue) . ';');
309+
return Util::format($fv, $format);
309310
} else if (is_callable($formatValue)) {
310311
return $formatValue($value, $row);
311312
} else {

0 commit comments

Comments
 (0)