Skip to content

Commit 8b37b19

Browse files
committed
Merge branch 'svnsync'
CHG: functions without parameter list doesn't have a sub_tree (set property sub_tree to false instead of an empty array) CHG: the column name has been changed from column to col, column is a reserved keyword, the parser doesn't categorize it as colref, I have add a TODO into the processor.
2 parents 2f1dfb4 + 7677e78 commit 8b37b19

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/PHPSQLParser/processors/ExpressionListProcessor.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ public function process($tokens) {
168168
}
169169

170170
if (!$curr->getSubTree()) {
171-
$curr->setSubTree($localExprList);
171+
if (!empty($localExprList)) {
172+
$curr->setSubTree($localExprList);
173+
}
172174
} else {
173175
$tmpExprList = $curr->getSubTree();
174176
$curr->setSubTree(array_merge($tmpExprList, $localExprList));
@@ -191,7 +193,9 @@ public function process($tokens) {
191193
}
192194

193195
if (!$curr->getSubTree()) {
194-
$curr->setSubTree($localExprList);
196+
if (!empty($localExprList)) {
197+
$curr->setSubTree($localExprList);
198+
}
195199
} else {
196200
$tmpExprList = $curr->getSubTree();
197201
$curr->setSubTree(array_merge($tmpExprList, $localExprList));
@@ -237,7 +241,9 @@ public function process($tokens) {
237241
}
238242

239243
if (!$curr->getSubTree()) {
240-
$curr->setSubTree($localExprList);
244+
if (!empty($localExprList)) {
245+
$curr->setSubTree($localExprList);
246+
}
241247
} else {
242248
$tmpExprList = $curr->getSubTree();
243249
$curr->setSubTree(array_merge($tmpExprList, $localExprList));
@@ -253,7 +259,9 @@ public function process($tokens) {
253259

254260
$curr->setTokenType(ExpressionType::BRACKET_EXPRESSION);
255261
if (!$curr->getSubTree()) {
256-
$curr->setSubTree($localExprList);
262+
if (!empty($localExprList)) {
263+
$curr->setSubTree($localExprList);
264+
}
257265
} else {
258266
$tmpExprList = $curr->getSubTree();
259267
$curr->setSubTree(array_merge($tmpExprList, $localExprList));

tests/cases/parser/issue72.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
require_once dirname(__FILE__) . '/../../../src/PHPSQLParser/PHPSQLParser.php';
4343
require_once dirname(__FILE__) . '/../../test-more.php';
4444

45-
$sql = "update table set column=@max";
45+
$sql = "update table set col=@max";
4646
$parser = new PHPSQLParser($sql);
4747
$p = $parser->parsed;
4848
$expected = getExpectedValue(dirname(__FILE__), 'issue72.serialized');

0 commit comments

Comments
 (0)