Skip to content

Commit 057f17a

Browse files
committed
Merge pull request #132 from phpcr/revert-square-bracket
Revert "Fixed parser so that square brackets count as delimiters"
2 parents 4b8d3d9 + 118d438 commit 057f17a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/PHPCR/Util/QOM/Sql2Scanner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ protected function tokenize(&$tokens, $token)
184184
$buffer = '';
185185
for ($i = 0; $i < strlen($token); $i++) {
186186
$char = trim(substr($token, $i, 1));
187-
if (in_array($char, array('[', ']', '.', ',', '(', ')', '='))) {
187+
if (in_array($char, array('.', ',', '(', ')', '='))) {
188188
if ($buffer !== '') {
189189
$tokens[] = $buffer;
190190
$buffer = '';

src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,10 +789,6 @@ protected function parseLiteralValue()
789789
return $this->parseCastLiteral($token);
790790
}
791791

792-
if ($this->scanner->tokenIs($token, 'NULL')) {
793-
return null;
794-
}
795-
796792
$quoteString = false;
797793
if (substr($token, 0, 1) === '\'') {
798794
$quoteString = "'";
@@ -939,9 +935,9 @@ private function fetchTokenWithoutBrackets()
939935
{
940936
$token = $this->scanner->fetchNextToken();
941937

942-
if ($token === '[') {
943-
$token = $this->scanner->fetchNextToken();
944-
$this->scanner->expectToken(']');
938+
if (substr($token, 0, 1) === '[' && substr($token, -1) === ']') {
939+
// Remove brackets around the selector name
940+
$token = substr($token, 1, -1);
945941
}
946942

947943
return $token;

0 commit comments

Comments
 (0)