From f2631f920a150c3ec93de3047190e221c6247ef7 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Thu, 29 Oct 2020 14:41:41 +0100 Subject: [PATCH 1/2] Fix stripping the base namespace for route name --- src/Sentry/Laravel/Integration.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Sentry/Laravel/Integration.php b/src/Sentry/Laravel/Integration.php index ae767e0b..0f6f1661 100644 --- a/src/Sentry/Laravel/Integration.php +++ b/src/Sentry/Laravel/Integration.php @@ -149,7 +149,14 @@ public static function extractNameForRoute(Route $route): ?string if (empty($routeName) && $route->getActionName()) { // SomeController@someAction (controller action) - $routeName = ltrim($route->getActionName(), (self::$baseControllerNamespace ?? '') . '\\'); + $routeName = $route->getActionName(); + + $baseNamespace = self::$baseControllerNamespace ?? ''; + + // Strip away the base namespace from the action name + if (!empty($baseNamespace)) { + $routeName = Str::after($routeName, $baseNamespace . '\\'); + } } if (empty($routeName) || $routeName === 'Closure') { From b498410040bb5da533f1b63d49124ad810af30d0 Mon Sep 17 00:00:00 2001 From: Alex Bouma Date: Thu, 29 Oct 2020 14:43:48 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce5e170c..c37ae1bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Fix incorrectly stripped base controller action from transaction name (#406) + ## 2.1.1 - Fix for potential `Undefined index: controllers_base_namespace.` notice