diff --git a/src/Bundle/Grid/Parser/OptionsParser.php b/src/Bundle/Grid/Parser/OptionsParser.php index 9c9f8b7f9..44f3d0528 100644 --- a/src/Bundle/Grid/Parser/OptionsParser.php +++ b/src/Bundle/Grid/Parser/OptionsParser.php @@ -79,7 +79,7 @@ private function parseOptionExpression(string $expression, Request $request) $expression = (string) preg_replace_callback('/\$(\w+)/', function (array $matches) use ($request) { $variable = $request->get($matches[1]); - return is_string($variable) ? sprintf('"%s"', $variable) : $variable; + return is_string($variable) ? sprintf('"%s"', addslashes($variable)) : $variable; }, $expression); return $this->expression->evaluate($expression, ['container' => $this->container]);