Skip to content

Commit 0e4c5fa

Browse files
hrs-obarryvdh
authored andcommitted
Fix explain mode regex barryvdh#363 (barryvdh#876)
1 parent 61f3be9 commit 0e4c5fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DataCollector/QueryCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function addQuery($query, $bindings, $time, $connection)
9494
$bindings = $connection->prepareBindings($bindings);
9595

9696
// Run EXPLAIN on this query (if needed)
97-
if ($this->explainQuery && preg_match('/^('.implode($this->explainTypes).') /i', $query)) {
97+
if ($this->explainQuery && preg_match('/^\s*('.implode('|', $this->explainTypes).') /i', $query)) {
9898
$statement = $pdo->prepare('EXPLAIN ' . $query);
9999
$statement->execute($bindings);
100100
$explainResults = $statement->fetchAll(\PDO::FETCH_CLASS);

0 commit comments

Comments
 (0)