Skip to content

Commit 20411e6

Browse files
committed
fix: if condition where the first segment is one of the aliases previously identified
Fixes #5360
1 parent 843ddb9 commit 20411e6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

system/Database/BaseConnection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,8 @@ public function protectIdentifiers($item, bool $prefixSingle = false, ?bool $pro
10121012
//
10131013
// NOTE: The ! empty() condition prevents this method
10141014
// from breaking when QB isn't enabled.
1015-
if (! empty($this->aliasedTables) && in_array($parts[0], $this->aliasedTables, true)) {
1015+
$firstSegment = trim($parts[0], $this->escapeChar);
1016+
if (! empty($this->aliasedTables) && in_array($firstSegment, $this->aliasedTables, true)) {
10161017
if ($protectIdentifiers === true) {
10171018
foreach ($parts as $key => $val) {
10181019
if (! in_array($val, $this->reservedIdentifiers, true)) {

0 commit comments

Comments
 (0)