Skip to content

Commit 2df2d39

Browse files
bug: CONCAT_WS should work with 2 parameters only
The previous code was working with at least 3 parameters which is incorrect.
1 parent 2e24c3d commit 2df2d39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Query/Mysql/ConcatWs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ public function parse(Parser $parser): void
2828
$this->values[] = $parser->ArithmeticExpression();
2929

3030
// Add the rest of the strings to the values array. CONCAT_WS must
31-
// be used with at least 2 strings not including the separator.
31+
// be used with at least 1 string not including the separator.
3232

3333
$lexer = $parser->getLexer();
3434

35-
while (count($this->values) < 3 || $lexer->lookahead->type === TokenType::T_COMMA) {
35+
while (count($this->values) < 2 || $lexer->lookahead->type === TokenType::T_COMMA) {
3636
$parser->match(TokenType::T_COMMA);
3737
$peek = $lexer->glimpse();
3838

0 commit comments

Comments
 (0)