mirror of
https://github.com/espocrm/espocrm.git
synced 2026-04-18 12:10:05 +00:00
Formula function trailing comma
This commit is contained in:
@@ -1282,6 +1282,10 @@ class Parser
|
||||
)
|
||||
);
|
||||
|
||||
if ($argument === '' && $i === count($commaIndexList) - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$argumentList[] = $argument;
|
||||
}
|
||||
|
||||
|
||||
@@ -2117,4 +2117,25 @@ class EvaluatorTest extends TestCase
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$this->evaluator->process($expression);
|
||||
}
|
||||
|
||||
public function testFunctionArguments(): void
|
||||
{
|
||||
$expression = "
|
||||
\$a = list(0, 1);
|
||||
\$b = list(0, 1,);
|
||||
\$c = list(
|
||||
0,
|
||||
1,
|
||||
);
|
||||
";
|
||||
|
||||
$vars = (object) [];
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$this->evaluator->process($expression, null, $vars);
|
||||
|
||||
$this->assertEquals([0, 1], $vars->a);
|
||||
$this->assertEquals([0, 1], $vars->b);
|
||||
$this->assertEquals([0, 1], $vars->c);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user