From f0cd5ffb4d3a081478be0ab20e4f04b652bb6d09 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 2 Apr 2020 09:19:16 +0100 Subject: [PATCH 1/3] Don't shorten class names in bradcrumbs --- src/Client.php | 8 -------- tests/ClientTest.php | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Client.php b/src/Client.php index bf258db6..f06bc57e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -21,8 +21,6 @@ use Composer\CaBundle\CaBundle; use GuzzleHttp\Client as Guzzle; use GuzzleHttp\ClientInterface; -use ReflectionClass; -use ReflectionException; class Client { @@ -242,12 +240,6 @@ public function registerMiddleware(callable $middleware) */ public function leaveBreadcrumb($name, $type = null, array $metaData = []) { - try { - $name = (new ReflectionClass($name))->getShortName(); - } catch (ReflectionException $e) { - // - } - $type = in_array($type, Breadcrumb::getTypes(), true) ? $type : Breadcrumb::MANUAL_TYPE; $this->recorder->record(new Breadcrumb($name, $type, $metaData)); diff --git a/tests/ClientTest.php b/tests/ClientTest.php index c3092852..aef8fa94 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -351,7 +351,7 @@ public function testBreadcrumbsFallback() $this->assertFalse(isset($breadcrumbs[0]['metaData'])); } - public function testBreadcrumbsNoName() + public function testBreadcrumbsWithNoName() { $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); @@ -372,7 +372,7 @@ public function testBreadcrumbsNoName() $this->assertTrue(isset($breadcrumbs[0]['metaData'])); } - public function testBreadcrumbsGetShortNameClass() + public function testBreadcrumbsWithClassName() { $this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle); @@ -386,7 +386,7 @@ public function testBreadcrumbsGetShortNameClass() $this->assertCount(3, $breadcrumbs[0]); $this->assertInternalType('string', $breadcrumbs[0]['timestamp']); - $this->assertSame('Client', $breadcrumbs[0]['name']); + $this->assertSame('Bugsnag\Client', $breadcrumbs[0]['name']); $this->assertSame('state', $breadcrumbs[0]['type']); $this->assertFalse(isset($breadcrumbs[0]['metaData'])); } From 2983ab1c3bdd99392af3a04be1c1a318fbd56606 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 2 Apr 2020 09:19:40 +0100 Subject: [PATCH 2/3] Apply fixes from StyleCI (#577) --- src/Request/BasicResolver.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Request/BasicResolver.php b/src/Request/BasicResolver.php index b0fc8ff8..6414e1e6 100644 --- a/src/Request/BasicResolver.php +++ b/src/Request/BasicResolver.php @@ -18,11 +18,13 @@ public function resolve() $params = static::getInputParams($_SERVER, $_POST, true); } - return new PhpRequest($_SERVER, + return new PhpRequest( + $_SERVER, empty($_SESSION) ? [] : $_SESSION, empty($_COOKIE) ? [] : $_COOKIE, static::getRequestHeaders($_SERVER), - $params); + $params + ); } if (PHP_SAPI === 'cli' && isset($_SERVER['argv'])) { From 426f0680195125583fbc7a9c26726e48f6907674 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 2 Apr 2020 17:36:28 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03fea4e3..5fd08922 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## Unreleased + +### Enhancements + +* Use full class names in breadcrumbs + [#578](https://github.com/bugsnag/bugsnag-php/pull/578) + ## 3.20.0 (2020-02-26) ### Enhancements