Skip to content

Commit fe9ef88

Browse files
committed
Fix condition 0
Signed-off-by: Maximilian Krög <[email protected]>
1 parent 43b1207 commit fe9ef88

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Components/Condition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
153153
} else {
154154
// The expression ended.
155155
$expr->expr = trim($expr->expr);
156-
if (! empty($expr->expr)) {
156+
if ($expr->expr !== '') {
157157
$ret[] = $expr;
158158
}
159159

@@ -214,7 +214,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
214214

215215
// Last iteration was not processed.
216216
$expr->expr = trim($expr->expr);
217-
if (! empty($expr->expr)) {
217+
if ($expr->expr !== '') {
218218
$ret[] = $expr;
219219
}
220220

tests/data/parser/parseWhere0.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,23 @@
168168
"columns": null,
169169
"partition": null,
170170
"where": [
171+
{
172+
"@type": "PhpMyAdmin\\SqlParser\\Components\\Condition",
173+
"identifiers": [],
174+
"isOperator": false,
175+
"expr": "0"
176+
},
171177
{
172178
"@type": "PhpMyAdmin\\SqlParser\\Components\\Condition",
173179
"identifiers": [],
174180
"isOperator": true,
175181
"expr": "AND"
182+
},
183+
{
184+
"@type": "PhpMyAdmin\\SqlParser\\Components\\Condition",
185+
"identifiers": [],
186+
"isOperator": false,
187+
"expr": "0"
176188
}
177189
],
178190
"order": null,

0 commit comments

Comments
 (0)