Skip to content

Commit

Permalink
fix(user-storage): update set method to properly validate the structu…
Browse files Browse the repository at this point in the history
…re before setting
  • Loading branch information
griffinmarc committed Jan 24, 2020
1 parent e4f1a9f commit b205d00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Constants/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class Constants
/**
* sdk version for api hit
*/
const SDK_VERSION = '1.5.1';
const SDK_VERSION = '1.5.2';
/**
* sdk langauge for api hit
*/
const SDK_LANGUAGE = 'php';
/**
* base url for api hit
*/
const BASE_URL = 'http://dev.visualwebsiteoptimizer.com/server-side/';
const BASE_URL = 'https://dev.visualwebsiteoptimizer.com/server-side/';
/**
* query string to fetch settings
*/
Expand Down
8 changes: 4 additions & 4 deletions src/VWO.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,17 @@ private function userStorageGet($userId, $campaignKey)
try {
if (!empty($this->_userStorageObj)) {
$variationInfo = $this->_userStorageObj->get($userId, $campaignKey);
if (isset($variationInfo[$campaignKey]['variationName']) && is_string($variationInfo[$campaignKey]['variationName']) && !empty($variationInfo[$campaignKey]['variationName'])) {
if (isset($variationInfo['variationName']) && is_string($variationInfo['variationName']) && !empty($variationInfo['variationName']) && isset($variationInfo['campaignKey']) && $variationInfo['campaignKey'] == $campaignKey) {
self::addLog(Logger::INFO, Constants::INFO_MESSAGES['LOOKING_UP_USER_STORAGE_SERVICE'], ['{userId}' => $userId]);
$campaign = Validations::validateCampaignName($campaignKey, $this->settings);
if ($campaign !== null) {
return $bucketInfo = Bucketer::getBucketVariationId($campaign, $variationInfo[$campaignKey]['variationName']);
return $bucketInfo = Bucketer::getBucketVariationId($campaign, $variationInfo['variationName']);
}
} else {
self::addLog(Logger::ERROR, Constants::ERROR_MESSAGE['GET_USER_STORAGE_SERVICE_FAILED']);
self::addLog(Logger::ERROR, Constants::ERROR_MESSAGE['GET_USER_STORAGE_SERVICE_FAILED'], ['{userId}' => $userId]);
}
} else {
self::addLog(Logger::DEBUG, Constants::DEBUG_MESSAGES['NO_USER_STORAGE_SERVICE_GET']);
self::addLog(Logger::DEBUG, Constants::DEBUG_MESSAGES['NO_USER_STORAGE_SERVICE_GET'], ['{userId}' => $userId]);
}
} catch (\Exception $e) {
self::addLog(Logger::ERROR, $e->getMessage());
Expand Down

0 comments on commit b205d00

Please sign in to comment.