Skip to content

Commit

Permalink
Guard against using feature not available in Lumen
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive committed Dec 8, 2023
1 parent c7d0b3b commit b770a36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Sentry/Laravel/Tracing/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public function register(): void
$this->app->singleton(Middleware::class, function () {
$continueAfterResponse = ($this->getTracingConfig()['continue_after_response'] ?? true) === true;

// Lumen introduced the `terminating` method in version 9.1.4.
// We check for it's existence and disable the continue after response feature if it's not available.
if (!method_exists($this->app, 'terminating')) {
$continueAfterResponse = false;
}

return new Middleware($this->app, $continueAfterResponse);
});
}
Expand Down

0 comments on commit b770a36

Please sign in to comment.