Skip to content

Commit 93f76d4

Browse files
committed
hack to fix Sql2ToQomConverterTest::testPropertyComparisonWithWhitespace
1 parent a901940 commit 93f76d4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/PHPCR/Util/QOM/Sql2Scanner.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ protected function scan($sql2)
152152
$tokens = array();
153153
$token = strtok($sql2, " \n\t");
154154
while ($token !== false) {
155-
156155
$this->tokenize($tokens, $token);
157156
$token = strtok(" \n\t");
158157
}

src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,12 @@ protected function parseLiteral()
731731
if ('' === $nextToken) {
732732
break;
733733
}
734-
$token .= $nextToken;
734+
// TODO: the scanner kills spaces, tabs and newlines
735+
// So adding a space here is just a hack for the most common token separator we can expect.
736+
// The proper way would require that the scanner tracks the token separators so that we
737+
// could fetch the separator between the last fetched token and the token before that token
738+
// so that we can append it instead of this hardcoded single space, ie. ' '
739+
$token .= ' '.$nextToken;
735740
}
736741

737742
if (substr($token, -1) !== $quoteString) {

0 commit comments

Comments
 (0)