Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions 30 src/Components/SetOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,27 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$commaLastSeenAt = $token;
}
} elseif ($state === 1) {
$tmp = Expression::parse(
$parser,
$list,
['breakOnAlias' => true]
);
if ($tmp === null) {
$parser->error('Missing expression.', $token);
break;
if ($token->flags & Token::FLAG_SYMBOL_PARAMETER) {
williamdes marked this conversation as resolved.
Show resolved Hide resolved
$expr->column = trim($expr->column);
$expr->value = $token->value;
$ret[] = $expr;
} else {
$tmp = Expression::parse(
$parser,
$list,
['breakOnAlias' => true]
);

if ($tmp === null) {
$parser->error('Missing expression.', $token);
break;
}

$expr->column = trim($expr->column);
$expr->value = $tmp->expr;
$ret[] = $expr;
}

$expr->column = trim($expr->column);
$expr->value = $tmp->expr;
$ret[] = $expr;
$expr = new static();
$state = 0;
$commaLastSeenAt = null;
Expand Down
1 change: 1 addition & 0 deletions 1 tests/Parser/UpdateStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static function updateProvider(): array
['parser/parseUpdate5'],
['parser/parseUpdate6'],
['parser/parseUpdate7'],
['parser/parseUpdate8'],
['parser/parseUpdateErr'],
];
}
Expand Down
2 changes: 1 addition & 1 deletion 2 tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function getErrorsAsArray($obj): array
*/
public function getData(string $name): array
{
$serializedData = file_get_contents('tests/data/' . $name . '.out');
$serializedData = file_get_contents(__DIR__ . '/data/' . $name . '.out');
williamdes marked this conversation as resolved.
Show resolved Hide resolved
$this->assertIsString($serializedData);

$serializer = new CustomJsonSerializer();
Expand Down
11 changes: 11 additions & 0 deletions 11 tests/data/parser/parseUpdate8.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
UPDATE
users
SET
username = ?,
id=155;

UPDATE
users
SET
username = :user_name,
id=155;
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.