Skip to content

Commit

Permalink
Update implementation to a better standard
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHarding committed Jan 8, 2018
1 parent a262c8c commit 7dd5988
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Raygun4php/RaygunClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function Send($message)

$message = $this->filterParamsFromMessage($message);
$message = $this->toJsonRemoveUnicodeSequences($message);
$message = str_replace("\0", '', $message);
$message = $this->removeNullBytes($message);

if(strlen($message) <= 0) {
return null;
Expand Down Expand Up @@ -419,6 +419,10 @@ function toJsonRemoveUnicodeSequences($struct) {
return preg_replace_callback("/\\\\u([a-f0-9]{4})/", function($matches){ return iconv('UCS-4LE','UTF-8',pack('V', hexdec("U$matches[1]"))); }, json_encode($struct));
}

function removeNullBytes($string) {
return str_replace("\0", '', $string);
}

/**
* Optionally applies a value transformation to every matching key, as defined by {@link FilterParams}.
* Replaces the value by default, but also supports custom transformations through
Expand Down

0 comments on commit 7dd5988

Please sign in to comment.