Skip to content

Commit

Permalink
handle find record array by numeric key in join
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jul 12, 2020
1 parent ac784fc commit d6513a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,14 @@ public function join(string $table, string $cond, string $type = '', bool $escap
}

$cond = ' ON ';
foreach ($conditions as $i => $condition)
$i = 0;
foreach ($conditions as $condition)
{
$operator = $this->getOperator($condition);
$operator = $this->getOperator($conditions[$i]);
$cond .= $joints[$i];
$cond .= preg_match("/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . '(.*)/i', $condition, $match) ? $match[1] . $this->db->protectIdentifiers($match[2]) . $operator . $this->db->protectIdentifiers($match[3]) : $condition;
$cond .= preg_match("/(\(*)?([\[\]\w\.'-]+)" . preg_quote($operator) . '(.*)/i', $conditions[$i], $match) ? $match[1] . $this->db->protectIdentifiers($match[2]) . $operator . $this->db->protectIdentifiers($match[3]) : $conditions[$i];

$i++;
}
}

Expand Down

0 comments on commit d6513a1

Please sign in to comment.