Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding breadcrumbs to sanitize / serialize. #538

Merged
merged 1 commit into from
Feb 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Raven/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,9 @@ public function sanitize(&$data)
if (!empty($data['contexts'])) {
$data['contexts'] = $this->serializer->serialize($data['contexts'], 5);
}
if (!empty($data['breadcrumbs'])) {
$data['breadcrumbs'] = $this->serializer->serialize($data['breadcrumbs'], 5);
}
}

/**
Expand Down
30 changes: 30 additions & 0 deletions test/Raven/Tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,36 @@ public function testSanitizeContexts()
)), $data);
}

/**
* @covers Raven_Client::sanitize
*/
public function testSanitizeBreadcrumbs()
{
$client = new Dummy_Raven_Client();
$data = array('breadcrumbs' => array(array(
'message' => 'foo',
'utf8' => pack("NA3CC", 3, "aBc", 0x0D, 0x0A),
'data' => array(
'line' => 1216,
'bindings' => array(
array('foo', pack("NA3CC", 3, "aBc", 0x0D, 0x0A)),
)
),
)));
$client->sanitize($data);

$this->assertEquals(array('breadcrumbs' => array(array(
'message' => 'foo',
'utf8' => mb_convert_encoding(pack("NA3CC", 3, "aBc", 0x0D, 0x0A), 'UTF-8'),
'data' => array(
'line' => 1216,
'bindings' => array(
array('foo', mb_convert_encoding(pack("NA3CC", 3, "aBc", 0x0D, 0x0A), 'UTF-8')),
)
),
))), $data);
}

/**
* @covers Raven_Client::buildCurlCommand
*/
Expand Down