Skip to content

Commit d7f2ad2

Browse files
committed
Fix bug when using a comma in querybuilder options
1 parent c6c9f53 commit d7f2ad2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Twig/Extension/EchoExtension.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public function convertAsForm($options, $formType)
7070
// Should we really check formType or can we just
7171
// look for query_builder option?
7272
if (preg_match("/EntityType$/i", $formType)) {
73+
preg_match("/'query_builder' => '(.+?)}',/i", $options, $matches);
74+
75+
if (count($matches) > 0) {
76+
$options = str_replace("'query_builder' => '$matches[1]}'", "'query_builder' => ".stripslashes($matches[1]).'}', $options);
77+
}
7378
preg_match("/'query_builder' => '(.+?)',/i", $options, $matches);
7479

7580
if (count($matches) > 0) {
@@ -79,6 +84,11 @@ public function convertAsForm($options, $formType)
7984

8085
// Same question here
8186
if (preg_match("/ModelType$/i", $formType)) {
87+
preg_match("/'query' => '(.+?)}',/i", $options, $matches);
88+
89+
if (count($matches) > 0) {
90+
$options = str_replace("'query' => '$matches[1]}'", "'query' => ".stripslashes($matches[1]).'}', $options);
91+
}
8292
preg_match("/'query' => '(.+?)',/i", $options, $matches);
8393

8494
if (count($matches) > 0) {

0 commit comments

Comments
 (0)