Skip to content

Commit 015cc60

Browse files
committed
BUGFIX: Correctly parse table name for some edge cases
1 parent f25f8ab commit 015cc60

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Classes/Logging/DebugStack.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ public function stopQuery(): void
8181
protected function parseTableName(string $sql): string
8282
{
8383
$sql = strtolower($sql);
84-
$start = strpos($sql, 'from ') + 5;
85-
$end = strpos($sql, ' ', $start);
86-
return substr($sql, $start, $end - $start);
84+
if (preg_match('/from\s+([`"\[]?[\w.]+[`"\]]?)/', $sql, $matches)) {
85+
return trim($matches[1], '`"[]');
86+
}
87+
return '';
8788
}
8889
}

0 commit comments

Comments
 (0)