Fix use of negative numbers in math equations. (#903)

Fixes #895
This commit is contained in:
Simon Wisselink
2023-09-14 10:21:06 +02:00
committed by GitHub
parent 7a58ca2517
commit af2e12d58e
3 changed files with 10 additions and 1 deletions
@@ -93,6 +93,14 @@ class MathTest extends PHPUnit_Smarty
$this->assertEquals($expected, $this->smarty->fetch($tpl));
}
public function testNegativeNumbers()
{
$this->smarty->disableSecurity();
$expected = "-19 -- 4.1";
$tpl = $this->smarty->createTemplate('eval:{$x = 4}{$y = 5.5}{math equation="-2.0*(x+y)" x=$x y=$y} -- {math equation="-20.5 / -5"}');
$this->assertEquals($expected, $this->smarty->fetch($tpl));
}
public function testSyntaxFormat()
{
$this->smarty->disableSecurity();