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 f99ced8 commit cb42a03
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Wrappers/Traits/EventTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,13 @@ final public function setRequest() {
'env' => $this->getEnv(),
'cookies' => $this->getCookies(),
];

$ctxRequest = new Context\Request();
$ctxRequest->mergeFromJsonString(json_encode($contextRequestArr));

$this->context->setRequest($ctxRequest);
try {
$ctxRequest->mergeFromJsonString(json_encode($contextRequestArr));
$this->context->setRequest($ctxRequest);
}catch(\Exception $ex){
}
}

/**
Expand Down Expand Up @@ -358,6 +360,15 @@ final protected function getCookieHeader(string $cookieHeader) : string
return empty($cookieMask) ? $cookieHeader : '';
}

/**
* Clean Bad Characters
*
* @param string $string
*
* @return string
* @author alikaviani <a.kaviani@sabavision.ir>
* @since 2020-04-10 14:43
*/
final protected function clean_non_chars($string) {
return preg_replace('/[^A-Za-z0-9\-\;\(\)\,\ \/\.]/', '', $string); // Removes special chars.
}
Expand Down

0 comments on commit cb42a03

Please # to comment.