formula fix string double backslash and quote
This commit is contained in:
@@ -144,7 +144,7 @@ class Parser
|
||||
{
|
||||
return
|
||||
($string[$i - 1] ?? null) !== "\\" ||
|
||||
($string[$i - 2] ?? null) === "\\";
|
||||
(($string[$i - 2] ?? null) === "\\" && ($string[$i - 3] ?? null) !== "\\");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1499,4 +1499,24 @@ class EvaluatorTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals("\n\\test\n", $result);
|
||||
}
|
||||
|
||||
public function testStrings8(): void
|
||||
{
|
||||
$expression = '"\\\\\\""';
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$result = $this->evaluator->process($expression);
|
||||
|
||||
$this->assertEquals("\\\"", $result);
|
||||
}
|
||||
|
||||
public function testStrings9(): void
|
||||
{
|
||||
$expression = '"\\\\\\"test\\\\\\""';
|
||||
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
$result = $this->evaluator->process($expression);
|
||||
|
||||
$this->assertEquals("\\\"test\\\"", $result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user