Skip to content

Commit eaa7a59

Browse files
authored
Fix null description not allowed (#751)
1 parent 1d85631 commit eaa7a59

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Sentry/Laravel/Features/Storage/SentryFilesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(Filesystem $filesystem, array $defaultData, bool $re
4646
*
4747
* @return mixed
4848
*/
49-
protected function withSentry(string $method, array $args, string $description, array $data)
49+
protected function withSentry(string $method, array $args, ?string $description, array $data)
5050
{
5151
$op = "file.{$method}"; // See https://develop.sentry.dev/sdk/performance/span-operations/#web-server
5252
$data = array_merge($data, $this->defaultData);

test/Sentry/Features/StorageIntegrationTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function testCreatesSpansFor(): void
2929
Storage::assertExists('foo', 'bar');
3030
Storage::delete('foo');
3131
Storage::delete(['foo', 'bar']);
32+
Storage::files();
3233

3334
$spans = $transaction->getSpanRecorder()->getSpans();
3435

@@ -62,6 +63,12 @@ public function testCreatesSpansFor(): void
6263
$this->assertSame('file.delete', $span->getOp());
6364
$this->assertSame('2 paths', $span->getDescription());
6465
$this->assertSame(['paths' => ['foo', 'bar'], 'disk' => 'local', 'driver' => 'local'], $span->getData());
66+
67+
$this->assertArrayHasKey(6, $spans);
68+
$span = $spans[6];
69+
$this->assertSame('file.files', $span->getOp());
70+
$this->assertNull($span->getDescription());
71+
$this->assertSame(['directory' => null, 'recursive' => false, 'disk' => 'local', 'driver' => 'local'], $span->getData());
6572
}
6673

6774
public function testDoesntCreateSpansWhenDisabled(): void
@@ -99,6 +106,7 @@ public function testCreatesBreadcrumbsFor(): void
99106
Storage::assertExists('foo', 'bar');
100107
Storage::delete('foo');
101108
Storage::delete(['foo', 'bar']);
109+
Storage::files();
102110

103111
$breadcrumbs = $this->getCurrentBreadcrumbs();
104112

@@ -132,6 +140,12 @@ public function testCreatesBreadcrumbsFor(): void
132140
$this->assertSame('file.delete', $span->getCategory());
133141
$this->assertSame('2 paths', $span->getMessage());
134142
$this->assertSame(['paths' => ['foo', 'bar'], 'disk' => 'local', 'driver' => 'local'], $span->getMetadata());
143+
144+
$this->assertArrayHasKey(5, $breadcrumbs);
145+
$span = $breadcrumbs[5];
146+
$this->assertSame('file.files', $span->getCategory());
147+
$this->assertNull($span->getMessage());
148+
$this->assertSame(['directory' => null, 'recursive' => false, 'disk' => 'local', 'driver' => 'local'], $span->getMetadata());
135149
}
136150

137151
public function testDoesntCreateBreadcrumbsWhenDisabled(): void

0 commit comments

Comments
 (0)