Skip to content

Commit

Permalink
fix: if condition where the first segment is one of the aliases previ…
Browse files Browse the repository at this point in the history
…ously identified

Fixes #5360
  • Loading branch information
kenjis committed Nov 20, 2021
1 parent 843ddb9 commit 20411e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,8 @@ public function protectIdentifiers($item, bool $prefixSingle = false, ?bool $pro
//
// NOTE: The ! empty() condition prevents this method
// from breaking when QB isn't enabled.
if (! empty($this->aliasedTables) && in_array($parts[0], $this->aliasedTables, true)) {
$firstSegment = trim($parts[0], $this->escapeChar);
if (! empty($this->aliasedTables) && in_array($firstSegment, $this->aliasedTables, true)) {
if ($protectIdentifiers === true) {
foreach ($parts as $key => $val) {
if (! in_array($val, $this->reservedIdentifiers, true)) {
Expand Down

0 comments on commit 20411e6

Please sign in to comment.