Skip to content

Commit

Permalink
Fixes a crash under Lumen 5.2.* with Laravel Components 5.2.*
Browse files Browse the repository at this point in the history
Laravel passes QueryExecuted event object and it cannot be cast as string
  • Loading branch information
ltsochev-dev committed Feb 11, 2016
1 parent c63c610 commit bd50f78
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/DataCollector/QueryCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ public function setExplainSource($enabled, $types)
*/
public function addQuery($query, $bindings, $time, $connection)
{
// If the query argument is an instance of QueryExecuted the rest of the
// arguments are probably wrong types and are going to crash
// the colletor.
if ( $query instanceof \Illuminate\Database\Events\QueryExecuted )
{
$bindings = $query->bindings;
$time = $query->time;
$connection = $query->connection;
$query = $query->sql;
}

$explainResults = array();
$time = $time / 1000;
$endTime = microtime(true);
Expand Down

0 comments on commit bd50f78

Please sign in to comment.