Skip to content

Commit

Permalink
Update EventTrait.php
Browse files Browse the repository at this point in the history
  • Loading branch information
subzerobo authored Dec 9, 2020
1 parent 488fbff commit f99ced8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Wrappers/Traits/EventTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ final public function setRequest() {
],
'headers' => [
'content_type' => $headers['Content-Type'] ?? '',
'user_agent' => $headers['User-Agent'] ?? '',
'user_agent' => $this->clean_non_chars($headers['User-Agent']) ?? '',
'cookie' => $this->getCookieHeader($headers['Cookie'] ?? ''),
],
'env' => $this->getEnv(),
Expand Down Expand Up @@ -357,6 +357,10 @@ final protected function getCookieHeader(string $cookieHeader) : string
// Returns an empty string if cookies are masked.
return empty($cookieMask) ? $cookieHeader : '';
}

final protected function clean_non_chars($string) {
return preg_replace('/[^A-Za-z0-9\-\;\(\)\,\ \/\.]/', '', $string); // Removes special chars.
}


}

0 comments on commit f99ced8

Please sign in to comment.