Skip to content

Commit

Permalink
fix where parser for 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Mar 30, 2018
1 parent ce0a7af commit 055dfb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions WhereParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function parseInCondition($operator, $operands, &$params)
throw new Exception("Operator '$operator' requires two operands.");
}

list($column, $values) = $operands;
[$column, $values] = $operands;

if ($values === [] || $column === []) {
return $operator === 'IN' ? '0=1' : '';
Expand All @@ -150,16 +150,16 @@ public function parseInCondition($operator, $operands, &$params)
}

$values = (array)$values;

if (is_array($column)) {
if (\is_array($column) && \count($column) > 1) {
return $this->parseCompositeInCondition($operator, $column, $values, $params);
}
if (\is_array($column)) {
$column = reset($column);
if (\count($column) > 1) {
return $this->parseCompositeInCondition($operator, $column, $values, $params);
}

}
foreach ($values as $i => $value) {
if (is_array($value)) {
$value = array_key_exists($column, $value) ? $value[$column] : null;
if (\is_array($value)) {
$value = $value[$column] ?? null;
}
if ($value === null) {
$values[$i] = 'NULL';
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"minimum-stability": "stable",
"require": {
"php": ">=7.0.0",
"php": ">=7.1.0",
"yiisoft/yii2-redis": "~2.0.6"
},
"autoload": {
Expand Down

0 comments on commit 055dfb4

Please sign in to comment.