Skip to content

Commit 7ff9e38

Browse files
committed
Sdk bug fixes
1 parent bf061fb commit 7ff9e38

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/EventManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GuzzleHttp\Psr7\Request;
66
use GuzzleHttp\Exception\RequestException;
7+
use phpDocumentor\Reflection\Types\Array_;
78

89
class EventManager
910
{
@@ -27,9 +28,10 @@ public function buildEvent(EventOptions $opts)
2728
$clientFP = json_decode($cookieDecoded);
2829
$eventType = $opts->eventType ? $opts->eventType : EventTypes::LOG_IN;
2930

30-
$cid = $clientFP->cid ? $clientFP->cid : '';
31+
$cid = $clientFP && $clientFP->cid ? $clientFP->cid : '';
32+
$fp = $clientFP && $clientFP->fp ? $clientFP->fp : '';
33+
3134
$vid = Utils::generateGuidV4();
32-
$fp = $clientFP->fp ? $clientFP->fp : '';
3335
$ip = $opts->ip ? $opts->ip : Utils::clientIpFromRequest();
3436
$remoteIP = $opts->remoteIp ? $opts->remoteIp : Utils::clientIpFromRequest();
3537
$userAgent = $opts->userAgent ? $opts->userAgent : Utils::userAgentFromRequest();

src/SecureNative.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function track(Array $attributes)
3434
throw new Exception("Can't send empty attributes");
3535
}
3636

37-
if (count($opts->params) > MAX_CUSTOM_PARAMS) {
37+
if (isset($opts->params) && count($opts->params) > MAX_CUSTOM_PARAMS) {
3838
throw new Exception(sprintf('You can only specify maximum of %d params', MAX_CUSTOM_PARAMS));
3939
}
4040

src/Utils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public static function userAgentFromRequest()
3434

3535
public static function securHeaderFromRequest()
3636
{
37-
if (array_key_exists('HTTTP_X_SECURENATIVE', $_SERVER)) {
38-
return $_SERVER['HTTTP_X_SECURENATIVE'];
37+
if (array_key_exists('HTTP_X_SECURENATIVE', $_SERVER)) {
38+
return $_SERVER['HTTP_X_SECURENATIVE'];
3939
}
4040
return '';
4141
}

0 commit comments

Comments
 (0)