Skip to content

Commit 31a18dc

Browse files
committed
Fix: Table's eval bug when column formatValue is a Math formula string
1 parent 0294716 commit 31a18dc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
7. Add RowNumColumn process, similar to CalculatedColumn's rownum but simpler
1111
8. Add "betweenInclusive" and "notBetweenInclusive" for Filter process
1212
9. Add using existed connection option for PDO, MySQL, PostgreSQL, SQL Server, and Oracle datasources
13+
10. Fix Table's eval bug when column formatValue is a Math formula string
1314

1415
## Version 6.2.0
1516
1. Fix Utility's arrayToDatastore function when there's only one column.

src/widgets/koolphp/Table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ protected function onInit()
187187
public static function formatValue($value, $format, $row = null, $cKey = null)
188188
{
189189
$formatValue = Utility::get($format, "formatValue");
190-
191190
if (is_string($formatValue)) {
192-
eval('$fv="' . str_replace('@value', '$value', $formatValue) . '";');
193-
return $fv;
191+
$fv = $formatValue;
192+
eval('$fv=' . str_replace('@value', $value, $formatValue) . ';');
193+
return Utility::format($fv, $format);
194194
} else if (is_callable($formatValue)) {
195195
return $formatValue($value, $row, $cKey);
196196
} else {
@@ -203,7 +203,7 @@ public static function formatValue($value, $format, $row = null, $cKey = null)
203203
*
204204
* @param array $meta The metadata
205205
* @param array $groupModel The group model
206-
* @param array $store The store
206+
* @param object $store The store
207207
* @param array $result The previous result
208208
* @param array $level The level
209209
* @param array $start The starting position

0 commit comments

Comments
 (0)