Skip to content

Commit ae813ad

Browse files
committed
Handling strings inside brackets
1 parent f8b891e commit ae813ad

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/PHPCR/Util/QOM/Sql2Scanner.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ protected function scan($sql2)
174174
$tokens[] = $currentToken;
175175
}
176176
$stringSize = $this->parseBrackets($sql2, $index);
177-
$tokens[] = substr($sql2, $index, $stringSize);
177+
$bracketContent = substr($sql2, $index + 1, $stringSize - 2);
178+
$tokens[] = '[' . trim($bracketContent, '"') . ']';
179+
178180
// We need to subtract one here because the for loop will automatically increment the index
179181
$index += $stringSize - 1;
180182
continue;

tests/PHPCR/Tests/Util/QOM/Sql2ScannerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function testSquareBrackets()
135135
'(',
136136
'file',
137137
',',
138-
'["/home node"]',
138+
'[/home node]',
139139
')',
140140
];
141141

0 commit comments

Comments
 (0)