Skip to content

Commit

Permalink
Adding breadcrumbs to sanitize / serialize. (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantology authored and Jean85 committed Feb 5, 2018
1 parent b1d1d21 commit 0904031
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
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

0 comments on commit 0904031

Please sign in to comment.